docs.unity3d.com
    Show / Hide Table of Contents

    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.

    Inheritance
    Object
    UIDocument
    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.

    In This Article
    • Properties
      • panelSettings
      • parentUI
      • rootVisualElement
      • sortingOrder
      • visualTreeAsset
    Back to top
    Copyright © 2023 Unity Technologies — Terms of use
    • Legal
    • Privacy Policy
    • Cookies
    • Do Not Sell or Share My Personal Information
    • Your Privacy Choices (Cookie Settings)
    "Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
    Generated by DocFX on 18 October 2023