Legacy Documentation: Version 2018.1 (Go to current version)
LanguageEnglish
  • C#
  • JS

Script language

Select your preferred scripting language. All code snippets will be displayed in this language.

EditorGUI

class in UnityEditor

/

Implemented in:UnityEditor

Suggest a change

Success!

Thank you for helping us improve the quality of Unity Documentation. Although we cannot accept all submissions, we do read each suggested change from our users and will make updates where applicable.

Close

Submission failed

For some reason your suggested change could not be submitted. Please <a>try again</a> in a few minutes. And thank you for taking the time to help us improve the quality of Unity Documentation.

Close

Cancel

Description

These work pretty much like the normal GUI functions - and also have matching implementations in EditorGUILayout.

Static Properties

actionKeyIs the platform-dependent "action" modifier key held down? (Read Only)
indentLevelThe indent level of the field labels.
showMixedValueMakes the following controls give the appearance of editing multiple different values.

Static Methods

BeginChangeCheckCheck if any control was changed inside a block of code.
BeginDisabledGroupCreate a group of controls that can be disabled.
BeginPropertyCreate a Property wrapper, useful for making regular GUI controls work with SerializedProperty.
BoundsFieldMake Center & Extents field for entering a Bounds.
BoundsIntFieldMake Position & Size field for entering a BoundsInt.
CanCacheInspectorGUIGet whether a SerializedProperty's inspector GUI can be cached.
ColorFieldMake a field for selecting a Color.
CurveFieldMake a field for editing an AnimationCurve.
DelayedDoubleFieldMake a delayed text field for entering doubles.
DelayedFloatFieldMake a delayed text field for entering floats.
DelayedIntFieldMake a delayed text field for entering integers.
DelayedTextFieldMake a delayed text field.
DoubleFieldMake a text field for entering doubles.
DrawPreviewTextureDraws the texture within a rectangle.
DrawRectDraws a filled rectangle of color at the specified position and size within the current editor window.
DrawTextureAlphaDraws the alpha channel of a texture within a rectangle.
DropdownButtonMake a button that reacts to mouse down, for displaying your own dropdown content.
DropShadowLabelDraws a label with a drop shadow.
EndChangeCheckEnds a change check started with BeginChangeCheck ().
EndDisabledGroupEnds a disabled group started with BeginDisabledGroup.
EndPropertyEnds a Property wrapper started with BeginProperty.
EnumFlagsFieldDisplays a menu with an option for every value of the enum type when clicked. An option for the value 0 with name "Nothing" and an option for the value ~0 (that is, all bits set) with the name "Everything" are always displayed at the top of the menu. The names for the values 0 and ~0 can be overriden by defining these values in the enum type.
EnumPopupMake an enum popup selection field.
FloatFieldMake a text field for entering floats.
FocusTextInControlMove keyboard focus to a named text field and begin editing of the content.
FoldoutMake a label with a foldout arrow to the left of it.
GetPropertyHeightGet the height needed for a PropertyField control.
HandlePrefixLabelMake a label for some control.
HelpBoxMake a help box with a message to the user.
InspectorTitlebarMake an inspector-window-like titlebar.
IntFieldMake a text field for entering integers.
IntPopupMake an integer popup selection field.
IntSliderMake a slider the user can drag to change an integer value between a min and a max.
LabelFieldMake a label field. (Useful for showing read-only info.)
LayerFieldMake a layer selection field.
LongFieldMake a text field for entering long integers.
MaskFieldMake a field for masks.
MinMaxSliderMake a special slider the user can use to specify a range between a min and a max.
MultiFloatFieldMake a multi-control with text fields for entering multiple floats in the same line.
MultiIntFieldMake a multi-control with text fields for entering multiple integers in the same line.
MultiPropertyFieldMake a multi-control with several property fields in the same line.
ObjectFieldMake an object field. You can assign objects either by drag and drop objects or by selecting an object using the Object Picker.
PasswordFieldMake a text field where the user can enter a password.
PopupMake a generic popup selection field.
PrefixLabelMake a label in front of some control.
ProgressBarMake a progress bar.
PropertyFieldUse this to make a field for a SerializedProperty in the Editor.
RectFieldMake an X, Y, W & H field for entering a Rect.
RectIntFieldMake an X, Y, W & H field for entering a RectInt.
SelectableLabelMake a selectable label field. (Useful for showing read-only info that can be copy-pasted.)
SliderMake a slider the user can drag to change a value between a min and a max.
TagFieldMake a tag selection field.
TextAreaMake a text area.
TextFieldMake a text field.
ToggleMake a toggle.
ToggleLeftMake a toggle field where the toggle is to the left and the label immediately to the right of it.
Vector2FieldMake an X & Y field for entering a Vector2.
Vector2IntFieldMake an X & Y integer field for entering a Vector2Int.
Vector3FieldMake an X, Y & Z field for entering a Vector3.
Vector3IntFieldMake an X, Y & Z integer field for entering a Vector3Int.
Vector4FieldMake an X, Y, Z & W field for entering a Vector4.

Did you find this page useful? Please give it a rating: