Version: 2019.1 (switch to 2019.2b or 2018.4)
Loading UXML from C#
UQuery
Other Versions

UXML Elements Reference

This topic details the UXML elements available in the UnityEngine.UIElements and UnityEditor.UIElements namespaces.

Base elements

VisualElement

Base class for all visual elements.

  • In UnityEngine.UIElements
  • Permitted child elements: any number of VisualElement
  • Attributes:
    • class: a list of space separated names
    • style: USS directives for styling the element
    • name: a unique string identifier for this element
    • focus-index:(OBSOLETE) Use focusable and tabIndex.
    • picking-mode: Position or Ignore; default value is Position
    • tooltip: a string displayed when the mouse hovers the element
    • focusable: a boolean indicating whether the element is focusable. Default is false (not focusable).
    • 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.
    • view-data-key : a string that defines the key used for serialization of the 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.

  • In UnityEngine.UIElements
  • Permitted child elements: any number of VisualElement
  • Attributes:
    • all attributes of VisualElement
    • binding-path: the path of the property this element is bound to

Utilities

Box

Similar to VisualElement but draws a box around its content.

  • In UnityEngine.UIElements
  • Permitted child elements: any number of VisualElement
  • Attributes:
    • all attributes of VisualElement

TextElement

An element that displays text.

  • In UnityEngine.UIElements
  • Permitted child elements: none
  • Attributes:
    • all attributes of VisualElement
    • text: the text displayed by the element

Label

A text label.

  • In UnityEngine.UIElements
  • Permitted child elements: none
  • Attributes:
    • all attributes of TextElement

Image

Displays an image.

  • In UnityEngine.UIElements
  • Permitted child elements: none
  • Attributes:
    • all attributes of VisualElement

IMGUIContainer

Elements that draws IMGUI content.

  • In UnityEngine.UIElements
  • Permitted child elements: none
  • Attributes:
    • all attributes of VisualElement
      • focus-index default value is 0
      • focusable default value is true

Foldout

Element that has a toggle button to show or hide its content.

  • In UnityEngine.UIElements
  • Permitted child elements: any number of VisualElement
  • Attributes:
    • all attributes of BindableElement

Templates

Template

A reference to another UXML template that can be instantiated using the Instance element.

  • In UnityEngine.UIElements
  • Permitted child elements: none
  • Attributes:
    • name: a unique string identifier for this element
    • path: the path of the UXML file to load

Instance

Instance of a Template.

  • In UnityEngine.UIElements
  • Permitted child elements: none
  • Attributes:
    • template: the name of the Template to instantiate

TemplateContainer

A template container

  • In UnityEngine.UIElements
  • Permitted child elements: none
  • Attributes:
    • all attributes of BindableElement
    • template: a string identifier for this template

Controls

BaseField<T>

The abstract base class of all fields.

  • In UnityEngine.UIElements
  • Permitted child elements: none
  • Attributes:
    • all attributes of BindableElement
      • focus-index default value is 0
      • focusable default value is true
    • label: the text of the label associated with the field

BaseFieldTraits<ValueType, UxmlType>

  • In UnityEngine.UIElements
  • Permitted child elements: none
  • Attributes:
    • all attributes of BaseField<ValueType>
    • value: the base value of the field, of type ValueType

Button

A standard push button.

  • In UnityEngine.UIElements
  • Permitted child elements: none
  • Attributes:
    • all attributes of TextElement

RepeatButton

A button that executes an action repeatedly while pressed.

  • In UnityEngine.UIElements
  • Permitted child elements: none
  • Attributes:
    • all attributes of TextElement
    • delay: the initial delay in milliseconds before the action is executed; default value is 0
    • interval: the interval in milliseconds between each action repetition; default value is 0

Toggle

A toggle button (checkbox).

  • In UnityEngine.UIElements
  • Permitted child elements: none
  • Attributes:
    • all attributes of BaseFieldTraits<bool, UxmlBoolAttributeDescription>
    • text : right side label of the toggle.

Scroller

A scroll bar.

  • In UnityEngine.UIElements
  • Permitted child elements: none
  • Attributes:
    • all attributes of VisualElement
    • low-value: minimum value of the scroller
    • high-value: maximum value of the scroller
    • direction: Horizontal or Vertical; default is Vertical
    • value: the position of the scroller cursor

Slider

A slider.

  • In UnityEngine.UIElements
  • Permitted child elements: none
  • Attributes:
    • all attributes of BaseFieldTraits<float, UxmlFloatAttributeDescription>
    • low-value: minimum value of the slider
    • high-value: maximum value of the slider
    • direction: Horizontal or Vertical; default is Horizontal
    • page-size: page size of the slider

SliderInt

A slider for integer values.

  • In UnityEngine.UIElements
  • Permitted child elements: none
  • Attributes:
    • all attributes of BaseFieldTraits<int, UxmlIntAttributeDescription>
    • low-value: minimum value of the slider
    • high-value: maximum value of the slider
    • direction: Horizontal or Vertical; default is Horizontal
    • page-size: page size of the slider

MinMaxSlider

A slider that let the user specify a minimum and a maximum value.

  • In UnityEngine.UIElements
  • Permitted child elements: none
  • Attributes:
    • all attributes of BaseField<Vector2>
    • low-limit: minimum value of the scroller
    • high-limit: maximum value of the scroller
    • min-value: the minimum value of the slider cursor
    • max-value: the maximum value of the slider cursor

EnumField

A field that can only take the string values of an underlying Enum.

  • In UnityEditor.UIElements
  • Permitted child elements: none
  • Attributes:
    • all attributes of BaseField<Enum>
    • type: required, a string representing the C# type of the underlying Enum
    • value: a string representing the value of the field

MaskField

A popup menu that enables the user to select a group of values.

  • In UnityEditor.UIElements
  • Permitted child elements: none
  • Attributes:
    • all attributes of BaseField<int>
    • choices: a comma separated list of up to 32 choices to display in the popup menu
    • value: an integer representing the value of the field as a 32 bits mask.

LayerField

A popup menu that enables the user to select a layerLayers in Unity can be used to selectively opt groups of GameObjects in or out of certain processes or calculations. This includes camera rendering, lighting, physics collisions, or custom calculations in your own code. More info
See in Glossary
.

  • In UnityEditor.UIElements
  • Permitted child elements: none
  • Attributes:
    • all attributes of BaseField<int>
    • value: an integer representing the value of the field (the selected layer number).

LayerMaskField

A popup menu that enables the user to select a group of layers.

  • In UnityEditor.UIElements
  • Permitted child elements: none
  • Attributes:
    • all attributes of MaskField

TagField

A popup menu that enables the user to select a tagA reference word which you can assign to one or more GameObjects to help you identify GameObjects for scripting purposes. For example, you might define and “Edible” Tag for any item the player can eat in your game. More info
See in Glossary
.

  • In UnityEditor.UIElements
  • Permitted child elements: none
  • Attributes:
    • all attributes of BaseField<string>
    • value: a string representing the value of the field (the selected tag name).

ProgressBar

A progress bar that shows the progression of an operation

  • In UnityEditor.UIElements
  • Permitted child elements: none
  • Attributes:
    • all attributes of BindableElement
    • low-value: a float representing the lowest value of the progress bar (default is 0).
    • high-value: a float representing the highest value of the progress bar (default is 100).
    • title: a string representing the title of the progress bar.

Text input

TextInputBaseField<TValueType>

An abstract base class for all text fields.

  • In UnityEngine.UIElements
  • Permitted child elements: none
  • Attributes:
    • all attributes of BaseFieldTraits<string, UxmlStringAttributeDescription>
    • text: the text value of the field
    • max-length: the maximum number of characters that the field can contains. Default value of -1 sets no limits on the text length.
    • password: a boolean indicating whether the field content should be shown (false, the default) or displayed using the maskCharacter character.
    • mask-character: character used to display the field content when password is true. Default is the character *.
    • readonly: boolean indicating the field is readonly (default value : false)

TextField

An editable text field.

  • In UnityEngine.UIElements
  • Permitted child elements: none
  • Attributes:
    • all attributes of TextInputBaseField<string>
    • multiline: a boolean indicating whether the text field displays its text on multiple lines (true) or on a single line, ignoring any line break in the text (false, the default).

IntegerField

A text field accepting an integer (32 bits) value.

  • In UnityEditor.UIElements
  • Permitted child elements: none
  • Attributes:
    • all attributes of BaseFieldTraits<int, UxmlIntAttributeDescription>

LongField

A text field accepting a long integer (64 bits) value.

  • In UnityEditor.UIElements
  • Permitted child elements: none
  • Attributes:
    • all attributes of BaseFieldTraits<long, UxmlLongAttributeDescription>

FloatField

A text field accepting a single precision floating point value.

  • In UnityEditor.UIElements
  • Permitted child elements: none
  • Attributes:
    • all attributes of BaseFieldTraits<float, UxmlFloatAttributeDescription>

DoubleField

A text field accepting a double precision floating point value.

  • In UnityEditor.UIElements
  • Permitted child elements: none
  • Attributes:
    • all attributes of BaseFieldTraits<double, UxmlDoubleAttributeDescription>

Vector2Field

A set of two text fields accepting floating point values to edit the value of a Vector2.

  • In UnityEditor.UIElements
  • Permitted child elements: none
  • Attributes:
    • all attributes of BaseField<Vector2>
    • x: the value of the X coordinate
    • y: the value of the Y coordinate

Vector2IntField

A set of two text fields accepting integer values to edit the value of a Vector2Int.

  • In UnityEditor.UIElements
  • Permitted child elements: none
  • Attributes:
    • all attributes of BaseField<Vector2Int>
    • x: the value of the X coordinate
    • y: the value of the Y coordinate

Vector3Field

A set of three text fields accepting floating point values to edit the value of a Vector3.

  • In UnityEditor.UIElements
  • Permitted child elements: none
  • Attributes:
    • all attributes of BaseField<Vector3>
    • x: the value of the X coordinate
    • y: the value of the Y coordinate
    • z: the value of the Z coordinate

Vector3IntField

A set of three text fields accepting integer values to edit the value of a Vector3Int.

  • In UnityEditor.UIElements
  • Permitted child elements: none
  • Attributes:
    • all attributes of BaseField<Vector3Int>
    • x: the value of the X coordinate
    • y: the value of the Y coordinate
    • z: the value of the Z coordinate

Vector4Field

A set of four text fields accepting floating point values to edit the value of a Vector4.

  • In UnityEditor.UIElements
  • Permitted child elements: none
  • Attributes:
    • all attributes of BaseField<Vector4>
    • x: the value of the X coordinate
    • y: the value of the Y coordinate
    • z: the value of the Z coordinate
    • w: the value of the W coordinate

RectField

A set of four text fields accepting floating point values to edit the value of a rectangle.

  • In UnityEditor.UIElements
  • Permitted child elements: none
  • Attributes:
    • all attributes of BaseField<Rect>
    • x: the value of the top left corner X coordinate
    • y: the value of the top left corner Y coordinate
    • w: the width of the rectangle
    • h: the height of the rectangle

RectIntField

A set of four text fields accepting integer values to edit the value of a rectangle.

  • In UnityEditor.UIElements
  • Permitted child elements: none
  • Attributes:
    • all attributes of BaseField<RectInt>
    • x: the value of the top left corner X coordinate
    • y: the value of the top left corner Y coordinate
    • w: the width of the rectangle
    • h: the height of the rectangle

BoundsField

A set of six text fields accepting floating point values to edit the value of a bounding rectangle.

  • In UnityEditor.UIElements
  • Permitted child elements: none
  • Attributes:
    • all attributes of BaseField<Bounds>
    • cx: the value of the center X coordinate
    • cy: the value of the center Y coordinate
    • cz: the value of the center Z coordinate
    • ex: the value of the extent X coordinate
    • ey: the value of the extent Y coordinate
    • ez: the value of the extent Z coordinate

BoundsIntField

A set of six text fields accepting integer values to edit the value of a bounding rectangle.

  • In UnityEditor.UIElements
  • Permitted child elements: none
  • Attributes:
    • all attributes of BaseField<BoundsInt>
    • px: the value of the position X coordinate
    • py: the value of the position Y coordinate
    • pz: the value of the position Z coordinate
    • sx: the value of the size X coordinate
    • sy: the value of the size Y coordinate
    • sz: the value of the size Z coordinate

Complex widgets

PropertyField

A label and a field to edit a value

  • In UnityEditor.UIElements
  • Permitted child elements: none
  • Attributes:
    • all attributes of VisualElement
    • binding-path: the path of the property this element is bound to
    • label: the label for the field

PropertyControl<int>

A label and a field to edit a value of type int

  • In UnityEditor.UIElements
  • Permitted child elements: none
  • Attributes:
    • all attributes of BaseField<int>
    • value-type: a string representing the type of value
    • value: the value for the field

PropertyControl<long>

A label and a field to edit a value of type long

  • In UnityEditor.UIElements
  • Permitted child elements: none
  • Attributes:
    • all attributes of BaseField<long>
    • value-type: a string representing the type of value
    • value: the value for the field

PropertyControl<float>

A label and a field to edit a value of type float

  • In UnityEditor.UIElements
  • Permitted child elements: none
  • Attributes:
    • all attributes of BaseField<float>
    • value-type: a string representing the type of value
    • value: the value for the field

PropertyControl<double>

A label and a field to edit a value of type double

  • In UnityEditor.UIElements
  • Permitted child elements: none
  • Attributes:
    • all attributes of BaseField<double>
    • value-type: a string representing the type of value
    • value: the value for the field

PropertyControl<string>

A label and a field to edit a value of type string

  • In UnityEditor.UIElements
  • Permitted child elements: none
  • Attributes:
    • all attributes of BaseField<string>
    • value-type: a string representing the type of value
    • value: the value for the field

ColorField

A color picker field.

  • In UnityEditor.UIElements
  • Permitted child elements: none
  • Attributes:
    • all attributes of BaseFieldTraits<Color, UxmlColorAttributeDescription>
    • show-eye-dropper: a boolean indicating whether to show (true, the default) the eye dropper or not (false).
    • show-alpha: a boolean indicating whether to show the alpha control (true, the default) or not (false)
    • hdr: a boolean indicating whether to use the high dynamic range color picker (true) or the normal one (false, the default)

CurveField

A curve editor field.

  • In UnityEditor.UIElements
  • Permitted child elements: none
  • Attributes:
    • all attributes of BaseField<AnimationCurve>

GradientField

A gradient editor field.

  • In UnityEditor.UIElements
  • Permitted child elements: none
  • Attributes:
    • all attributes of BaseField<Gradient>

ObjectField

An object selector field.

  • In UnityEditor.UIElements
  • Permitted child elements: none
  • Attributes:
    • all attributes of BaseField<Object>
    • allow-scene-objects: a boolean indicating whether objects from the sceneA Scene contains the environments and menus of your game. Think of each unique Scene file as a unique level. In each Scene, you place your environments, obstacles, and decorations, essentially designing and building your game in pieces. More info
      See in Glossary
      can be selected (true, the default) or not (false)

InspectorElement

An element that displays a property in an inspectorA Unity window that displays information about the currently selected GameObject, Asset or Project Settings, alowing you to inspect and edit the values. More info
See in Glossary
window.

  • In UnityEditor.UIElements
  • Permitted child elements: any number of VisualElement
  • Attributes:
    • all attributes of BindableElement

Toolbar

Toolbar

A container to hold toolbarA row of buttons and basic controls at the top of the Unity Editor that allows you to interact with the Editor in various ways (e.g. scaling, translation). More info
See in Glossary
items.

  • In UnityEditor.UIElements
  • Permitted child elements: any VisualElement
  • Attributes:
    • all attributes of VisualElement

ToolbarButton

A button for the toolbar.

  • In UnityEditor.UIElements
  • Permitted child elements: none
  • Attributes:
    • all attributes of Button

ToolbarToggle

A toggle for the toolbar.

  • In UnityEditor.UIElements
  • Permitted child elements: none
  • Attributes:
    • all attributes of Toggle

ToolbarMenu

A drop down menu for the toolbar. The menu has a single arrow pointing down.

  • In UnityEditor.UIElements
  • Permitted child elements: none
  • Attributes:
    • all attributes of TextElement

ToolbarSearchField

A search field for the toolbar.

  • In UnityEditor.UIElements
  • Permitted child elements: none
  • Attributes:
    • all attributes of VisualElement

ToolbarPopupSearchField

A search field with a popup menu of search options.

  • In UnityEditor.UIElements
  • Permitted child elements: none
  • Attributes:
    • all attributes of ToolbarSearchField

ToolbarSpacer

An element that insert a fixed amount of whitespace between toolbar buttons.

  • In UnityEditor.UIElements
  • Permitted child elements: none
  • Attributes:
    • all attributes of VisualElement

Views and windows

ListView

Displays a list of elements.

  • In UnityEngine.UIElements
  • Permitted child elements: none
  • Attributes:
    • all attributes of VisualElement
    • item-height: the height in pixelThe smallest unit in a computer image. Pixel size depends on your screen resolution. Pixel lighting is calculated at every screen pixel. More info
      See in Glossary
      of each item in the list

ScrollView

A scrollable view, with horizontal and vertical scrollers.

  • In UnityEngine.UIElements
  • Permitted child elements: any number of VisualElement
  • Attributes:
    • all attributes of VisualElement
    • mode: the mode of the scroll view, default to ScrollViewMode.Vertical
    • show-horizontal-scroller: a boolean indicating whether to show the horizontal scroller; default false
    • show-vertical-scroller: a boolean indicating whether to show the vertical scroller; default `false
    • horizontal-page-size: page size value of the horizontal scroller
    • vertical-page-size: page size of the vertical scroller

TreeView

A view for displaying elements in a tree hierarchy

  • In UnityEngine.UIElements
  • Permitted child elements: none
  • Attributes:
    • all attributes of VisualElement
    • item-height: the height of an item in the underlying list shown

PopupWindow

A UIElements window, displayed on top of other content.

  • In UnityEngine.UIElements
  • Permitted child elements: any number of VisualElement
  • Attributes:
    • all attributes of TextElement

Did you find this page useful? Please give it a rating:

Loading UXML from C&#35;
UQuery