Version: 2022.1
Load UXML from C# scripts
UXML element BindableElement

UXML elements reference

The following tables outline the UXML elements available in the UnityEngine.UIElements and UnityEditor.UIElements namespaces.

Base elements

Element Namespace Permitted child elements C# class
BindableElement UnityEngine.UIElements Any number of VisualElement UnityEngine.UIElements.BindableElement
VisualElement UnityEngine.UIElements Any number of VisualElement UnityEngine.UIElements.VisualElement

Controls

Element Namespace Permitted child elements C# class
BoundsField UnityEngine.UIElements Any number of VisualElement UnityEngine.UIElements.BoundsField
BoundsIntField UnityEngine.UIElements Any number of VisualElement UnityEngine.UIElements.BoundsIntField
Box UnityEngine.UIElements Any number of VisualElement UnityEngine.UIElements.Box
Button UnityEngine.UIElements None UnityEngine.UIElements.Button
ColorField UnityEditor.UIElements Any number of VisualElement UnityEditor.UIElements.ColorField
CurveField UnityEditor.UIElements Any number of VisualElement UnityEditor.UIElements.CurveField
DoubleField UnityEngine.UIElements Any number of VisualElement UnityEngine.UIElements.DoubleField
DropdownField UnityEngine.UIElements Any number of VisualElement UnityEngine.UIElements.DropdownField
EnumField UnityEngine.UIElements Any number of VisualElement UnityEngine.UIElements.EnumField
EnumFlagsField UnityEditor.UIElements Any number of VisualElement UnityEditor.UIElements.EnumFlagsField
FloatField UnityEngine.UIElements Any number of VisualElement UnityEngine.UIElements.FloatField
Foldout UnityEngine.UIElements Any number of VisualElement UnityEngine.UIElements.Foldout
GradientField UnityEditor.UIElements Any number of VisualElement UnityEditor.UIElements.GradientField
GroupBox UnityEngine.UIElements Any number of VisualElement UnityEngine.UIElements.GroupBox
Hash128Field UnityEngine.UIElements Any number of VisualElement UnityEngine.UIElements.Hash128Field
HelpBox UnityEngine.UIElements Any number of VisualElement UnityEngine.UIElements.HelpBox
IMGUIContainer UnityEngine.UIElements None UnityEngine.UIElements.IMGUIContainer
Image UnityEngine.UIElements None UnityEngine.UIElements.Image
InspectorElement UnityEditor.UIElements Any number of VisualElement UnityEditor.UIElements.InspectorElement
IntegerField UnityEngine.UIElements Any number of VisualElement UnityEngine.UIElements.IntegerField
Label UnityEngine.UIElements None UnityEngine.UIElements.Label
LayerField UnityEditor.UIElements Any number of VisualElement UnityEditor.UIElements.LayerField
LayerMaskField UnityEditor.UIElements Any number of VisualElement UnityEditor.UIElements.LayerMaskField
ListView UnityEngine.UIElements None UnityEngine.UIElements.ListView
LongField UnityEngine.UIElements Any number of VisualElement UnityEngine.UIElements.LongField
MaskField UnityEditor.UIElements Any number of VisualElement UnityEditor.UIElements.MaskField
MinMaxSlider UnityEngine.UIElements Any number of VisualElement UnityEngine.UIElements.MinMaxSlider
MultiColumnListView UnityEngine.UIElements None UnityEngine.UIElements.MultiColumnListView
MultiColumnTreeView UnityEngine.UIElements None UnityEngine.UIElements.MultiColumnTreeView
ObjectField UnityEditor.UIElements Any number of VisualElement UnityEditor.UIElements.ObjectField
PopupWindow UnityEngine.UIElements Any number of VisualElement UnityEngine.UIElements.PopupWindow
ProgressBar UnityEngine.UIElements Any number of VisualElement UnityEngine.UIElements.ProgressBar
PropertyField UnityEditor.UIElements Any number of VisualElement UnityEditor.UIElements.PropertyField
RadioButton UnityEngine.UIElements Any number of VisualElement UnityEngine.UIElements.RadioButton
RadioButtonGroup UnityEngine.UIElements Any number of VisualElement UnityEngine.UIElements.RadioButtonGroup
RectField UnityEngine.UIElements Any number of VisualElement UnityEngine.UIElements.RectField
RectIntField UnityEngine.UIElements Any number of VisualElement UnityEngine.UIElements.RectIntField
RepeatButton UnityEngine.UIElements None UnityEngine.UIElements.RepeatButton
ScrollView UnityEngine.UIElements Any number of VisualElement UnityEngine.UIElements.ScrollView
Scroller UnityEngine.UIElements None UnityEngine.UIElements.Scroller
Slider UnityEngine.UIElements Any number of VisualElement UnityEngine.UIElements.Slider
SliderInt UnityEngine.UIElements Any number of VisualElement UnityEngine.UIElements.SliderInt
TagField UnityEditor.UIElements Any number of VisualElement UnityEditor.UIElements.TagField
TextElement UnityEngine.UIElements None UnityEngine.UIElements.TextElement
TextField UnityEngine.UIElements Any number of VisualElement UnityEngine.UIElements.TextField
Toggle UnityEngine.UIElements Any number of VisualElement UnityEngine.UIElements.Toggle
Toolbar UnityEditor.UIElements Any number of VisualElement UnityEditor.UIElements.Toolbar
ToolbarBreadcrumbs UnityEditor.UIElements Any number of VisualElement UnityEditor.UIElements.ToolbarBreadcrumbs
ToolbarButton UnityEditor.UIElements None UnityEditor.UIElements.ToolbarButton
ToolbarMenu UnityEditor.UIElements None UnityEditor.UIElements.ToolbarMenu
ToolbarPopupSearchField UnityEditor.UIElements Any number of VisualElement UnityEditor.UIElements.ToolbarPopupSearchField
ToolbarSearchField UnityEditor.UIElements Any number of VisualElement UnityEditor.UIElements.ToolbarSearchField
ToolbarSpacer UnityEditor.UIElements Any number of VisualElement UnityEditor.UIElements.ToolbarSpacer
ToolbarToggle UnityEditor.UIElements Any number of VisualElement UnityEditor.UIElements.ToolbarToggle
TreeView UnityEngine.UIElements None UnityEngine.UIElements.TreeView
TwoPaneSplitView UnityEngine.UIElements None UnityEngine.UIElements.TwoPaneSplitView
Vector2Field UnityEngine.UIElements Any number of VisualElement UnityEngine.UIElements.Vector2Field
Vector2IntField UnityEngine.UIElements Any number of VisualElement UnityEngine.UIElements.Vector2IntField
Vector3Field UnityEngine.UIElements Any number of VisualElement UnityEngine.UIElements.Vector3Field
Vector3IntField UnityEngine.UIElements Any number of VisualElement UnityEngine.UIElements.Vector3IntField
Vector4Field UnityEngine.UIElements Any number of VisualElement UnityEngine.UIElements.Vector4Field

Templates

Element Function Namespace Permitted child elements Attributes
Template A reference to another UXML template that can be instantiated using the Instance element. UnityEngine.UIElements None name: A unique string identifier for this element
path: The path of the UXML file to load
Instance Instance of a Template UnityEngine.UIElements None template: The name of the Template to instantiate
TemplateContainer A template container. UnityEngine.UIElements None All attributes of BindableElement
template: A string identifier for this template

UxmlObject Attributes

Element Function Namespace Permitted child elements Attributes
Columns Contains descriptions of columns. Must be a child of a parent that supports it, such as MultiColumnListView or MultiColumnTreeView. UnityEngine.UIElements Column None
Column Describes a column. Must be a child of Columns. UnityEngine.UIElements None name: The name of this column in code
title: The name displayed in the header of this column
width: The default width of this column in pixels
Load UXML from C# scripts
UXML element BindableElement
Copyright © 2020 Unity Technologies
优美缔软件(上海)有限公司 版权所有
"Unity"、Unity 徽标及其他 Unity 商标是 Unity Technologies 或其附属机构在美国及其他地区的商标或注册商标。其他名称或品牌是其各自所有者的商标。
公安部备案号:
31010902002961