以下表格概括了 UnityEngine.UIElements and UnityEditor.UIElements 命名空间中提供的 UXML 元素。
| Element | Function | Namespace | Permitted child elements | Attributes | 
|---|---|---|---|---|
| VisualElement | The base class for all visual elements. | UnityEngine.UIElements | Any number of VisualElement | class: A list of space separated names.style: USS directives to style the element.name: A unique string identifier for this element.picking-mode: Set toPositionorIgnore. The default value isPosition.tooltip: When the mouse hovers the element a string displays.focusable: A boolean that indicates whether the element is focusable. The default is set tofalse(not focusable). This replaces the obsoletefocus-indexelement.tabindex: An integer that defines the tabbing position of the element and the position in the tree. A positive value increases tabbing priority. The default is 0. This replaces the obsoletefocus-indexelement.view-data-key: A string that defines the key used for serialization of the element.This element also accepts any other attribute. | 
| BindableElement | An element that can be bound to a SerializedProperty. The value of the property and the value displayed are synchronized. | UnityEngine.UIElements | Any number of VisualElement | binding-path: The path of the property that this element is bound to. | 
| Element | Function | Namespace | Permitted child elements | Attributes | 
|---|---|---|---|---|
| Box | This element is similar to VisualElementbut draws a box around its content. | UnityEngine.UIElements | Any number of VisualElement | All attributes of VisualElement | 
| TextElement | An element that displays text. | UnityEngine.UIElements | None | All attributes of VisualElementtext: The text the element should display. | 
| Label | A text label. | UnityEngine.UIElements | None | All attributes of TextElement | 
| Image | Displays an image. | UnityEngine.UIElements | None | All attributes of VisualElement | 
| IMGUIContainer | Draws IMGUI content | UnityEngine.UIElements | None | All attributes of VisualElementfocus-indexdefault value is0focusabledefault value istrue | 
| Foldout | An element that has a toggle button to show or hide its content. | UnityEngine.UIElements | Any number of VisualElement | All attributes of BindableElement | 
| Element | Function | Namespace | Permitted child elements | Attributes | 
|---|---|---|---|---|
| Template | A reference to another UXML template that can be instantiated using the Instanceelement. | UnityEngine.UIElements | None | name: A unique string identifier for this elementpath: The path of the UXML file to load | 
| Instance | Instance of a Template | UnityEngine.UIElements | None | template: Thenameof theTemplateto instantiate | 
| TemplateContainer | A template container. | UnityEngine.UIElements | None | All attributes of BindableElementtemplate: A string identifier for this template | 
| Element | Function | Namespace | Permitted child elements | Attributes | 
|---|---|---|---|---|
| BaseField<T> | The abstract base class of all fields. | UnityEngine.UIElements | None | All attributes of BindableElementfocus-indexdefault value is0focusabledefault value istruelabel: The text of the label that is associated with the field | 
| BaseFieldTraits<ValueType, UxmlType> | UnityEngine.UIElements | None | All attributes of BaseField<ValueType>value: The base value of the field, of typeValueType | |
| Button | A standard push button. | UnityEngine.UIElements | None | All attributes of TextElement | 
| RepeatButton | A button that executes an action repeatedly while pressed. | UnityEngine.UIElements | None | All attributes of TextElementdelay: The initial delay in milliseconds before the element executes the action is executed. The default value is0interval: The interval in milliseconds between repeating each action. The default value is0 | 
| Toggle | A toggle button, displayed as a checkbox. | UnityEngine.UIElements | None | All attributes of BaseFieldTraits<bool, UxmlBoolAttributeDescription>text: Right side label of the toggle. | 
| Scroller | A scroll bar. | UnityEngine.UIElements | None | All attributes of VisualElementlow-value: The minimum value of the scrollerhigh-value: The maximum value of the scrollerdirection: Set toHorizontalorVertical. The default isVertical.value: The position of the scroller cursor | 
| Slider | A slider. | UnityEngine.UIElements | None | All attributes of BaseFieldTraits<float, UxmlFloatAttributeDescription>low-value: The minimum value of the sliderhigh-value: The maximum value of the sliderdirection: Set toHorizontalorVertical. The default isHorizontal.page-size: The page size of the slider | 
| SliderInt | A slider for integer values. | UnityEngine.UIElements | None | All attributes of BaseFieldTraits<int, UxmlIntAttributeDescription>low-value: The minimum value of the sliderhigh-value: The maximum value of the sliderdirection: Set toHorizontalorVertical. The default isHorizontal.page-size: The page size of the slider | 
| MinMaxSlider | A slider that lets the user specify a minimum and a maximum value. | UnityEngine.UIElements | None | All attributes of BaseField<Vector2>low-limit: The minimum value of the scrollerhigh-limit: The maximum value of the scrollermin-value: The minimum value of the slider cursormax-value: The maximum value of the slider cursor | 
| EnumField | A field that takes the string values of an underlying Enum. | UnityEditor.UIElements | None | All attributes of BaseField<Enum>type: A string representing the C# type of the underlyingEnum. If the type is in a user assembly, the assembly name must be added to the type name:MyNamespace.MyEnum, MyAssembly. Thetypestring is always required.value: A string that represents the value of the field | 
| MaskField | A popup menu that the user can select a group of values from. | UnityEditor.UIElements | None | All attributes of BaseField<int>choices: A comma separated list of up to 32 choices to display in the popup menuvalue: An integer that represents the value of the field as a 32-bit mask. | 
| LayerField | A popup menu that the user can select a layer from. | UnityEditor.UIElements | None | All attributes of BaseField<int>value: An integer that represents the value of the field (the selected layer number). | 
| LayerMaskField | A popup menu that the user can select a group of layers from. | UnityEditor.UIElements | None | All attributes of MaskField | 
| TagField | A popup menu that the user can select a tag from. | UnityEditor.UIElements | None | All attributes of BaseField<string>value: A string that represents the value of the field (the selected tag name). | 
| ProgressBar | A progress bar that shows the progression of an operation. | UnityEditor.UIElements | None | All attributes of BindableElementlow-value: A float that represents the lowest value of the progress bar. The default is 0.high-value: A float that represents the highest value of the progress bar. The default is 100.title: A string that represents the title of the progress bar. | 
| Element | Function | Namespace | Permitted child elements | Attributes | 
|---|---|---|---|---|
| TextInputBaseField<TValueType> | An abstract base class for all text fields. | UnityEngine.UIElements | None | All attributes of BaseFieldTraits<string, UxmlStringAttributeDescription>text: The text value of the fieldmax-length: The maximum number of characters that the field can contain. Default value of-1sets no limits on the text length.password: A boolean that indicates whether the field content should be shown or displayed using themaskCharactercharacter.falseis the default setting.mask-character: A character that displays the field content whenpasswordistrue. Default is the character*.readonly: A boolean that indicates that the field is read-only. The default value isfalse | 
| TextField | An editable text field. | UnityEngine.UIElements | None | All attributes of TextInputBaseField<string>multiline: A boolean that indicates whether the text field displays its text on multiple lines. Set totrueto display on multiple lines, or set tofalseto display or on a single line, ignoring any line break in the text.falseis the default. | 
| IntegerField | A text field that accepts an integer (32-bit) value. | UnityEditor.UIElements | None | All attributes of BaseFieldTraits<int, UxmlIntAttributeDescription> | 
| LongField | A text field that accepts a long integer (64 bits) value. | UnityEditor.UIElements | None | All attributes of BaseFieldTraits<long, UxmlLongAttributeDescription> | 
| FloatField | A text field that accepts a single precision floating point value. | UnityEditor.UIElements | None | All attributes of BaseFieldTraits<float, UxmlFloatAttributeDescription> | 
| DoubleField | A text field that accepts a double precision floating point value. | UnityEditor.UIElements | None | All attributes of BaseFieldTraits<double, UxmlDoubleAttributeDescription> | 
| Vector2Field | A set of two text fields that accept floating point values to edit the value of a Vector2. | UnityEditor.UIElements | None | All attributes of BaseField<Vector2>x: The value of the X coordinatey: The value of the Y coordinate | 
| Vector2IntField | A set of two text fields that accept integer values to edit the value of a Vector2Int. | UnityEditor.UIElements | None | All attributes of BaseField<Vector2Int>x: The value of the X coordinatey: The value of the Y coordinate | 
| Vector3Field | A set of three text fields that accept floating point values to edit the value of a Vector3. | UnityEditor.UIElements | None | All attributes of BaseField<Vector3>x: The value of the X coordinatey: The value of the Y coordinatez: The value of the Z coordinate | 
| Vector3IntField | A set of three text fields that accept integer values to edit the value of a Vector3Int. | UnityEditor.UIElements | None | All attributes of BaseField<Vector3Int>x: The value of the X coordinatey: The value of the Y coordinatez: The value of the Z coordinate | 
| Vector4Field | A set of four text fields that accept floating point values to edit the value of a Vector4. | UnityEditor.UIElements | None | All attributes of BaseField<Vector4>x: The value of the X coordinatey: The value of the Y coordinatez: The value of the Z coordinatew: The value of the W coordinate | 
| RectField | A set of four text fields that accept floating point values to edit the value of a rectangle. | UnityEditor.UIElements | None | All attributes of BaseField<Rect>x: The value of the top left corner X coordinatey: The value of the top left corner Y coordinatew: The width of the rectangleh: the height of the rectangle | 
| RectIntField | A set of four text fields that accept integer values to edit the value of a rectangle. | UnityEditor.UIElements | None | All attributes of BaseField<RectInt>x: The value of the top left corner X coordinatey: The value of the top left corner Y coordinatew: The width of the rectangleh: the height of the rectangle | 
| BoundsField | A set of six text fields that accept floating point values to edit the value of a bounding rectangle. | UnityEditor.UIElements | None | All attributes of BaseField<Bounds>cx: The value of the center X coordinatecy: The value of the center Y coordinatecz: The value of the center Z coordinateex: The value of the extent X coordinateey: The value of the extent Y coordinateez: The value of the extent Z coordinate | 
| BoundsIntField | A set of six text fields that accept integer values to edit the value of a bounding rectangle. | UnityEditor.UIElements | None | All attributes of BaseField<BoundsInt>px: The value of the position X coordinatepy: The value of the postion Y coordinatepz: The value of the position Z coordinatesx: The value of the size X coordinatesy: The value of the size Y coordinatesz: The value of the size Z coordinate | 
| Element | Function | Namespace | Permitted child elements | Attributes | 
|---|---|---|---|---|
| PropertyField | A label and a field to edit a value. | UnityEditor.UIElements | None | All attributes of VisualElementbinding-path: The path of the property this element is bound tolabel: The label for the field | 
| PropertyControl<int> | A label and a field to edit a value of type int. | UnityEditor.UIElements | None | All attributes of BaseField<int>value-type: A string that represents the type of valuevalue: The value for the field | 
| PropertyControl<long> | A label and a field to edit a value of type long. | UnityEditor.UIElements | None | All attributes of BaseField<long>value-type: A string that represents the type of valuevalue: The value for the field | 
| PropertyControl<float> | A label and a field to edit a value of type float. | UnityEditor.UIElements | None | All attributes of BaseField<float>value-type: A string that represents the type of valuevalue: The value for the field | 
| PropertyControl<double> | A label and a field to edit a value of type double. | UnityEditor.UIElements | None | All attributes of BaseField<double>value-type: A string that represents the type of valuevalue: The value for the field | 
| PropertyControl<string> | A label and a field to edit a value of type string. | UnityEditor.UIElements | None | All attributes of BaseField<string>value-type: A string that represents the type of valuevalue: The value for the field | 
| ColorField | A color picker field. | UnityEditor.UIElements | None | All attributes of BaseFieldTraits<Color, UxmlColorAttributeDescription>show-eye-dropper: A boolean that indicates whether to show the eye dropper or not. Set totrueto display the eye dropper, andfalseto hide it. By default this is set totrue.show-alpha: A boolean that indicates whether to show the alpha control. Set totrueto show the control orfalseto hide it. By default this is set totrue.hdr: A boolean that indicates whether to use the high dynamic range color picker. Set totrueto use the picker. By default this is set tofalse. | 
| CurveField | A curve editor field. | UnityEditor.UIElements | None | All attributes of BaseField<AnimationCurve> | 
| GradientField | A gradient editor field. | UnityEditor.UIElements | None | All attributes of BaseField<Gradient> | 
| ObjectField | An object selector field. | UnityEditor.UIElements | None | All attributes of BaseField<Object>allow-scene-objects: A boolean that indicates whether objects from the scene can be selected. Set totrueto enable object selection orfalsedisable it. By default this is set totrue. | 
| InspectorElement | An element that displays a property in an inspector window. | UnityEditor.UIElements | Any number of VisualElement | All attributes of BindableElement | 
| Element | Function | Namespace | Permitted child elements | Attributes | 
|---|---|---|---|---|
| Toolbar | A container to hold toolbar items. | UnityEditor.UIElements | Any VisualElement | All attributes of VisualElement | 
| ToolbarButton | A button for the toolbar. | UnityEditor.UIElements | None | All attributes of Button | 
| ToolbarToggle | A toggle for the toolbar. | UnityEditor.UIElements | None | All attributes of Toggle | 
| ToolbarMenu | A drop down menu for the toolbar. The menu has a single arrow pointing down. | UnityEditor.UIElements | None | All attributes of TextElement | 
| ToolbarSearchField | A search field for the toolbar. | UnityEditor.UIElements | None | All attributes of VisualElement | 
| ToolbarPopupSearchField | A search field with a popup menu of search options. | UnityEditor.UIElements | None | All attributes of VisualElement | 
| ToolbarSpacer | An element that inserts a fixed amount of whitespace between toolbar buttons. | UnityEditor.UIElements | None | All attributes of VisualElement | 
| Element | Function | Namespace | Permitted child elements | Attributes | 
|---|---|---|---|---|
| ListView | Displays a list of elements. | UnityEngine.UIElements | None | All attributes of VisualElementitem-height: The height in pixels of each item in the list | 
| ScrollView | A scrollable view, with horizontal and vertical scrollers. | UnityEngine.UIElements | Any number of VisualElement | All attributes of VisualElementmode: the mode of the scroll view. By default this is set toScrollViewMode.Verticalshow-horizontal-scroller: A boolean that indicates whether to show the horizontal scroller. By default this is set tofalseshow-vertical-scroller: A boolean that indicates whether to show the vertical scroller. By default this is set tofalsehorizontal-page-size: The page size value of the horizontal scrollervertical-page-size: The page size of the vertical scroller | 
| TreeView | A view for displaying elements in a tree hierarchy. | UnityEngine.UIElements | Any number of VisualElement | All attributes of VisualElementitem-height: The height of an item in the underlying list shown | 
| PopupWindow | A UIElements window, displayed on top of other content. | UnityEditor.UIElements | None | All attributes of TextElement |