Version: Unity 6.3 LTS (6000.3)
LanguageEnglish
  • C#

BaseField<T0>

class in UnityEngine.UIElements

/

Inherits from:UIElements.BindableElement

/

Implemented in:UnityEngine.UIElementsModule


Implements interfaces:IMixedValueSupport, INotifyValueChanged<T0>

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


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.

Static Properties

Property 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.

Properties

Property Description
label The string representing the label that will appear beside the field. If the string is empty, the label element is removed from the hierarchy. If the string is not empty, the label element is added to the hierarchy.
labelElement This is the Label object that appears beside the input for the field.
mixedValueLabel Read-only label used to give the appearance of editing multiple different values.
rawValue The value of the element.
showMixedValue When set to true, gives the field the appearance of editing multiple different values.
value The value associated with the field.

Public Methods

Method Description
SetValueWithoutNotify Allow to set a value without being notified of the change, if any.

Protected Methods

Method Description
UpdateMixedValueContent Update the field's visual content depending on showMixedValue.

Inherited Members

Static Properties

PropertyDescription
disabledUssClassName USS class name of local disabled elements.

Properties

PropertyDescription
binding Binding object that will be updated.
bindingPath Path of the target property to be bound.
canGrabFocus Whether the element can be focused.
delegatesFocus Whether the element delegates the focus to its children.
focusable Whether an element can potentially receive focus.
focusController Returns the focus controller for this element.
tabIndex An integer used to sort focusable elements in the focus ring. Must be greater than or equal to zero.
childCount Number of child elements in this object's contentContainer.
contentContainer Logical container where child elements are added. If a child is added to this element, the child is added to this element's content container instead.
contentRect The rectangle of the content area of the element, in the local space of the element. (Read Only)
customStyle The custom style properties accessor of a VisualElement (Read Only).
dataSource Assigns a data source to this VisualElement which overrides any inherited data source. This data source is inherited by all children.
dataSourcePath Path from the data source to the value.
dataSourceType The possible type of data source assignable to this VisualElement. This information is only used by the UI Builder as a hint to provide some completion to the data source path field when the effective data source cannot be specified at design time.
disablePlayModeTint Play-mode tint is applied by default unless this is set to true. It's applied hierarchically to this VisualElement and to all its children that exist on an editor panel.
enabledInHierarchy Returns true if the VisualElement is enabled in its own hierarchy.
enabledSelf Returns true if the VisualElement is enabled locally.
experimental Returns the UIElements experimental interfaces.
generateVisualContent Delegate function to generate the visual content of a visual element.
hasActivePseudoState Returns true if this element matches the :active pseudo-class.