Class UIDocument
Defines a Component that connects VisualElements to GameObjects. This makes it possible to render UI defined in UXML documents in the Game view.
Namespace: UnityEngine.UIElements
Syntax
public sealed class UIDocument : MonoBehaviour
Properties
panelSettings
Specifies the PanelSettings instance to connect this UIDocument component to.
Declaration
public PanelSettings panelSettings { get; set; }
Property Value
Type | Description |
---|---|
PanelSettings |
Remarks
The Panel Settings asset defines the panel that renders UI in the game view. See PanelSettings.
If this UIDocument has a parent UIDocument, it uses the parent's PanelSettings automatically.
parentUI
If the GameObject that this UIDocument component is attached to has a parent GameObject, and that parent GameObject also has a UIDocument component attached to it, this value is set to the parent GameObject's UIDocument component automatically.
Declaration
public UIDocument parentUI { get; }
Property Value
Type | Description |
---|---|
UIDocument |
Remarks
If a UIDocument has a parent, you cannot add it directly to a panel. Unity adds it to the parent's root visual element instead.
rootVisualElement
The root visual element where the UI hierarchy starts.
Declaration
public VisualElement rootVisualElement { get; }
Property Value
Type | Description |
---|---|
VisualElement |
sortingOrder
The order in which this UIDocument will show up on the hierarchy in relation to other UIDocuments either attached to the same PanelSettings, or with the same UIDocument parent.
Declaration
public float sortingOrder { get; set; }
Property Value
Type | Description |
---|---|
Single |
visualTreeAsset
The VisualTreeAsset loaded into the root visual element automatically.
Declaration
public VisualTreeAsset visualTreeAsset { get; set; }
Property Value
Type | Description |
---|---|
VisualTreeAsset |
Remarks
If you leave this empty, the root visual element is also empty.