Documentation

Unity Engine


User Manual

Script Reference

Unity Engine


UxmlAttributeField

An Editor-only control that displays a serialized UXML attribute in the Inspector, with override indicators and binding affordances.
Read time 9 minutesLast updated 8 days ago

Definition

[UxmlElement]public class UxmlAttributeField : VisualElement, IEventHandler, IResolvedStyle, ITransform, ITransitionAnimations, IExperimentalFeatures, IVisualElementScheduler, ICustomStyle

Remarks

Use UxmlAttributeField when you build custom drawers that derive from UxmlSerializedDataPropertyDrawer, so your fields match the auto-generated Inspector. The control shows the current attribute state: default, set inline, overridden in a template instance, or driven by a data binding.
When you don't set _label, it falls back to the display name of the bound SerializedProperty.
The following example creates a field bound to a property from
FindPropertyRelative
inside a drawer.

Examples

var textProperty = property.FindPropertyRelative("text");if (textProperty != null){ var field = new UxmlAttributeField(textProperty); field.label = "Text Content"; container.Add(field);}

Static Fields

Value

Description

ussClassNameThe USS class name for a UXML attribute field.

Constructors

Constructor

Description

UxmlAttributeField()Creates an unbound field. Set _bindingPath to bind it to a serialized property.
UxmlAttributeField(UnityEditor.SerializedProperty)Creates a field bound to the given serialized property.

Properties

Property

Description

bindingPathThe binding path of the serialized property this field displays and edits.
decoratorThe decorator that draws the override indicator bar, binding affordances, and context menu for this field.
labelThe label shown next to the field's input control.

Inheritance

Inherited Members