Version: 2019.1
C# から UXML を読み込む
UQuery

UXML 要素リファレンス

以下の表は、UnityEngine.UIElementsUnityEditor.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 to Position or Ignore. The default value is Position.
tooltip: When the mouse hovers the element a string displays.
focusable: A boolean that indicates whether the element is focusable. The default is set to false (not focusable). This replaces the obsolete focus-index element.
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 obsolete focus-index element.
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 VisualElement but 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 VisualElement
text: 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 VisualElement
focus-index default value is 0
focusable default value is true
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 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

コントロール

Element Function Namespace Permitted child elements Attributes
BaseField<T> The abstract base class of all fields. UnityEngine.UIElements None All attributes of BindableElement
focus-index default value is 0
focusable default value is true
label: 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 type ValueType
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 TextElement
delay: The initial delay in milliseconds before the element executes the action is executed. The default value is 0
interval: The interval in milliseconds between repeating each action. The default value is 0
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 VisualElement
low-value: The minimum value of the scroller
high-value: The maximum value of the scroller
direction: Set to Horizontal or Vertical. The default is Vertical.
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 slider
high-value: The maximum value of the slider
direction: Set to Horizontal or Vertical. The default is Horizontal.
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 slider
high-value: The maximum value of the slider
direction: Set to Horizontal or Vertical. The default is Horizontal.
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 scroller
high-limit: The 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 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 underlying Enum. If the type is in a user assembly, the assembly name must be added to the type name: MyNamespace.MyEnum, MyAssembly. The type string 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 menu
value: 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 BindableElement
low-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 field
max-length: The maximum number of characters that the field can contain. Default value of -1 sets no limits on the text length.
password: A boolean that indicates whether the field content should be shown or displayed using the maskCharacter character. false is the default setting.
mask-character: A character that displays the field content when password is true. Default is the character *.
readonly: A boolean that indicates that the field is read-only. The default value is false
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 to true to display on multiple lines, or set to false to display or on a single line, ignoring any line break in the text. false is 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 coordinate
y: 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 coordinate
y: 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 coordinate
y: The value of the Y coordinate
z: 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 coordinate
y: The value of the Y coordinate
z: 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 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 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 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 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 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 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 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 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 coordinate
py: The value of the postion 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

複雑なウィジェット

Element Function Namespace Permitted child elements Attributes
PropertyField A label and a field to edit a value. UnityEditor.UIElements None 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. UnityEditor.UIElements None All attributes of BaseField<int>
value-type: A string that represents the type of value
value: 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 value
value: 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 value
value: 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 value
value: 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 value
value: 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 to true to display the eye dropper, and false to hide it. By default this is set to true.
show-alpha: A boolean that indicates whether to show the alpha control. Set to true to show the control or false to hide it. By default this is set to true.
hdr: A boolean that indicates whether to use the high dynamic range color picker. Set to true to use the picker. By default this is set to false.
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 to true to enable object selection or false disable it. By default this is set to true.
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 VisualElement
item-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 VisualElement
mode: the mode of the scroll view. By default this is set to ScrollViewMode.Vertical
show-horizontal-scroller: A boolean that indicates whether to show the horizontal scroller. By default this is set to false
show-vertical-scroller: A boolean that indicates whether to show the vertical scroller. By default this is set to false
horizontal-page-size: The page size value of the horizontal scroller
vertical-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 VisualElement
item-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

  • 2019–05–20
C# から UXML を読み込む
UQuery