Version: 2022.2
LanguageEnglish
  • C#

EditorGUI

class 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

BeginChangeCheckStarts a new code block to check for GUI changes.
BeginDisabledGroupCreate a group of controls that can be disabled.
BeginFoldoutHeaderGroupMake a label with a foldout arrow to the left of it.
BeginPropertyCreate a Property wrapper, useful for making regular GUI controls work with SerializedProperty.
BoundsFieldMakes Center and Extents field for entering a Bounds.
BoundsIntFieldMakes Position and Size field for entering a BoundsInt.
CanCacheInspectorGUIGet whether a SerializedProperty's inspector GUI can be cached.
ColorFieldMakes a field for selecting a Color.
CurveFieldMakes a field for editing an AnimationCurve.
DelayedDoubleFieldMakes a delayed text field for entering doubles.
DelayedFloatFieldMakes a delayed text field for entering floats.
DelayedIntFieldMakes a delayed text field for entering integers.
DelayedTextFieldMakes a delayed text field.
DoubleFieldMakes 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.
DropdownButtonMakes a button that reacts to mouse down, for displaying your own dropdown content.
DropShadowLabelDraws a label with a drop shadow.
EndChangeCheckEnds a code block and checks for any GUI changes.
EndDisabledGroupEnds a disabled group started with BeginDisabledGroup.
EndFoldoutHeaderGroupCloses a group started with BeginFoldoutHeaderGroup. See Also: EditorGUILayout.BeginFoldoutHeaderGroup.
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.
EnumPopupMakes an enum popup selection field.
FloatFieldMakes a text field for entering floats.
FocusTextInControlMove keyboard focus to a named text field and begin editing of the content.
FoldoutMakes a label with a foldout arrow to the left of it.
GetPropertyHeightGet the height needed for a PropertyField control.
GradientFieldMakes a field for editing a Gradient.
HandlePrefixLabelMakes a label for some control.
HelpBoxMakes a help box with a message to the user.
InspectorTitlebarMakes an inspector-window-like titlebar.
IntFieldMakes a text field for entering integers.
IntPopupMakes an integer popup selection field.
IntSliderMakes a slider the user can drag to change an integer value between a min and a max.
LabelFieldMakes a label field. (Useful for showing read-only info.)
LayerFieldMakes a layer selection field.
LinkButtonMake a clickable link label.
LongFieldMakes a text field for entering long integers.
MaskFieldMakes a field for masks.
MinMaxSliderMakes a special slider the user can use to specify a range between a min and a max.
MultiFloatFieldMakes a multi-control with text fields for entering multiple floats in the same line.
MultiIntFieldMakes a multi-control with text fields for entering multiple integers in the same line.
MultiPropertyFieldMakes a multi-control with several property fields in the same line.
ObjectFieldMakes an object field. You can assign objects either by drag and drop objects or by selecting an object using the Object Picker.
PasswordFieldMakes a text field where the user can enter a password.
PopupMakes a generic popup selection field.
PrefixLabelMakes a label in front of some control.
ProgressBarMakes a progress bar.
PropertyFieldUse this to make a field for a SerializedProperty in the Editor.
RectFieldMakes an X, Y, W, and H field for entering a Rect.
RectIntFieldMakes an X, Y, W, and H field for entering a RectInt.
SelectableLabelMakes a selectable label field. (Useful for showing read-only info that can be copy-pasted.)
SliderMakes a slider the user can drag to change a value between a min and a max.
TagFieldMakes a tag selection field.
TextAreaMakes a text area.
TextFieldMakes a text field.
ToggleMakes a toggle.
ToggleLeftMakes a toggle field where the toggle is to the left and the label immediately to the right of it.
Vector2FieldMakes an X and Y field for entering a Vector2.
Vector2IntFieldMakes an X and Y integer field for entering a Vector2Int.
Vector3FieldMakes an X, Y, and Z field for entering a Vector3.
Vector3IntFieldMakes an X, Y, and Z integer field for entering a Vector3Int.
Vector4FieldMakes an X, Y, Z, and W field for entering a Vector4.

Events

hyperLinkClickedEvent used to react on clicks on a text hyperlink part.
Copyright © 2023 Unity Technologies
优美缔软件(上海)有限公司 版权所有
"Unity"、Unity 徽标及其他 Unity 商标是 Unity Technologies 或其附属机构在美国及其他地区的商标或注册商标。其他名称或品牌是其各自所有者的商标。
公安部备案号:
31010902002961