BaseField<TValueType>
Abstract base class for controls. A BaseField is a base class for field elements like TextField and IntegerField. To align a BaseField element automatically with other fields in an Inspector window, use the.unity-base-field__aligned USS class. This style class is designed for use with Inspector elements like PropertyField, which has the style class by default. However, if you manually add a child BaseField element to a PropertyField, you must add the style class manually. When the style class is present, the field automatically calculates the label width to align with other fields in the Inspector window. If there are IMGUI fields present, UI Toolkit fields are aligned with them for consistency and compatibility.
Read time 10 minutesLast updated 2 days ago
Definition
- Type: Class
- Namespace: UnityEngine.UIElements
- Assembly: UnityEngine.UIElementsModule
- Inherits from: AbstractBaseField
- Implements: IEventHandler, IResolvedStyle, ITransform, ITransitionAnimations, IExperimentalFeatures, IVisualElementScheduler, ICustomStyle, IBindable, IMixedValueSupport, INotifyValueChanged<T>
[UxmlElement]public abstract class BaseField<TValueType> : AbstractBaseField, IEventHandler, IResolvedStyle, ITransform, ITransitionAnimations, IExperimentalFeatures, IVisualElementScheduler, ICustomStyle, IBindable, IMixedValueSupport, INotifyValueChanged<TValueType>
Static Fields
Value | Description |
|---|---|
| alignedFieldUssClassName | USS class name of elements that are aligned in a inspector element |
| inputUssClassName | USS class name of input elements in elements of this type. |
| labelDraggerVariantUssClassName | USS class name of labels in elements of this type, when there is a dragger attached on them. |
| labelUssClassName | USS class name of labels in elements of this type. |
| mixedValueLabelUssClassName | USS class name of elements that show mixed values |
| noLabelVariantUssClassName | USS class name of elements of this type, when there is no label. |
| ussClassName | USS class name of elements of this type. |
Constructors
Constructor | Description |
|---|---|
| BaseField`1(System.String,UnityEngine.UIElements.VisualElement) | Initializes and returns an instance of BaseField<TValueType>. |
Properties
Methods
Method | Description |
|---|---|
| IgnoreValidation | Disables _onValidateValue until the returned scope is disposed. |
| SetValueWithoutNotify | Allow to set a value without being notified of the change, if any. |
Events
Member | Description |
|---|---|
| onValidateValue | An event raised to validate or adjust the field's value before committing it. |
Structs
Struct | Description |
|---|---|
| BaseField<TValueType>.IgnoreValidationScope | A scope, returned by BaseField<TValueType>.IgnoreValidation(), that disables _onValidateValue until it is disposed. |
Delegates
Delegate | Description |
|---|---|
| BaseField<TValueType>.ValidateValueHandler | Represents a method that validates or adjusts a field's value before committing it. |