Class EnumField
Makes a dropdown for switching between enum values.
Inherited Members
Namespace: UnityEditor.UIElements
Syntax
public class EnumField : BaseField<Enum>, IEventHandler, ITransform, ITransitionAnimations, IExperimentalFeatures, IVisualElementScheduler, IResolvedStyle, IBindable, INotifyValueChanged<Enum>, IMixedValueSupport
Constructors
EnumField()
Construct an EnumField.
Declaration
public EnumField()
EnumField(Enum)
Construct an EnumField.
Declaration
public EnumField(Enum defaultValue)
Parameters
Type | Name | Description |
---|---|---|
Enum | defaultValue | Initial value. Also used to detect Enum type. |
EnumField(String, Enum)
Construct an EnumField.
Declaration
public EnumField(string label, Enum defaultValue = null)
Parameters
Type | Name | Description |
---|---|---|
String | label | |
Enum | defaultValue | Initial value. Also used to detect Enum type. |
Fields
arrowUssClassName
USS class name of arrow indicators in elements of this type.
Declaration
public static readonly string arrowUssClassName
Field Value
Type | Description |
---|---|
String |
inputUssClassName
USS class name of input elements in elements of this type.
Declaration
public static readonly string inputUssClassName
Field Value
Type | Description |
---|---|
String |
labelUssClassName
USS class name of labels in elements of this type.
Declaration
public static readonly string labelUssClassName
Field Value
Type | Description |
---|---|
String |
textUssClassName
USS class name of text elements in elements of this type.
Declaration
public static readonly string textUssClassName
Field Value
Type | Description |
---|---|
String |
ussClassName
USS class name of elements of this type.
Declaration
public static readonly string ussClassName
Field Value
Type | Description |
---|---|
String |
Properties
text
Return the text value of the currently selected enum.
Declaration
public string text { get; }
Property Value
Type | Description |
---|---|
String |
Methods
ExecuteDefaultActionAtTarget(EventBase)
Declaration
protected override void ExecuteDefaultActionAtTarget(EventBase evt)
Parameters
Type | Name | Description |
---|---|---|
EventBase | evt |
Overrides
Init(Enum)
Initializes the EnumField with a default value, and initializes its underlying type.
Declaration
public void Init(Enum defaultValue)
Parameters
Type | Name | Description |
---|---|---|
Enum | defaultValue | The typed enum value. |
Init(Enum, Boolean)
Initializes the EnumField with a default value, and initializes its underlying type.
Declaration
public void Init(Enum defaultValue, bool includeObsoleteValues)
Parameters
Type | Name | Description |
---|---|---|
Enum | defaultValue | The typed enum value. |
Boolean | includeObsoleteValues | Set to true to display obsolete values as choices. |
SetValueWithoutNotify(Enum)
Declaration
public override void SetValueWithoutNotify(Enum newValue)
Parameters
Type | Name | Description |
---|---|---|
Enum | newValue |
Overrides
UpdateMixedValueContent()
Declaration
protected override void UpdateMixedValueContent()