docs.unity3d.com
    Show / Hide Table of Contents

    Class VisualTreeAsset

    An instance of this class holds a tree of VisualElementAssets, created from a UXML file. Each node in the file corresponds to a VisualElementAsset. You can clone a VisualTreeAsset to yield a tree of VisualElements.

    Inheritance
    Object
    VisualTreeAsset
    Namespace: UnityEngine.UIElements
    Syntax
    public class VisualTreeAsset : ScriptableObject

    Properties

    contentHash

    A hash value computed from the template content.

    Declaration
    public int contentHash { get; set; }
    Property Value
    Type Description
    Int32

    stylesheets

    The stylesheets used by this VisualTreeAsset.

    Declaration
    public IEnumerable<StyleSheet> stylesheets { get; }
    Property Value
    Type Description
    IEnumerable<StyleSheet>

    templateDependencies

    The UXML templates used by this VisualTreeAsset.

    Declaration
    public IEnumerable<VisualTreeAsset> templateDependencies { get; }
    Property Value
    Type Description
    IEnumerable<VisualTreeAsset>

    Methods

    CloneTree()

    Build a tree of VisualElements from the asset.

    Declaration
    public TemplateContainer CloneTree()
    Returns
    Type Description
    TemplateContainer

    The root of the tree of VisualElements that was just cloned.

    Remarks

    This function will be deprecated. Use instead.

    CloneTree(String)

    Build a tree of VisualElements from the asset.

    Declaration
    public TemplateContainer CloneTree(string bindingPath)
    Parameters
    Type Name Description
    String bindingPath

    The path to the property that you want to bind to the root of the cloned tree.

    Returns
    Type Description
    TemplateContainer

    The root of the tree of VisualElements that was just cloned.

    Remarks

    This function will be deprecated. Use instead.

    CloneTree(VisualElement)

    Builds a tree of VisualElements from the asset.

    Declaration
    public void CloneTree(VisualElement target)
    Parameters
    Type Name Description
    VisualElement target

    A VisualElement that will act as the root of the cloned tree.

    CloneTree(VisualElement, out Int32, out Int32)

    Declaration
    public void CloneTree(VisualElement target, out int firstElementIndex, out int elementAddedCount)
    Parameters
    Type Name Description
    VisualElement target
    Int32 firstElementIndex
    Int32 elementAddedCount

    Instantiate()

    Build a tree of VisualElements from the asset.

    Declaration
    public TemplateContainer Instantiate()
    Returns
    Type Description
    TemplateContainer

    The root of the tree of VisualElements that was just cloned.

    Instantiate(String)

    Build a tree of VisualElements from the asset.

    Declaration
    public TemplateContainer Instantiate(string bindingPath)
    Parameters
    Type Name Description
    String bindingPath

    The path to the property that you want to bind to the root of the cloned tree.

    Returns
    Type Description
    TemplateContainer

    The root of the tree of VisualElements that was just cloned.

    In This Article
    • Properties
      • contentHash
      • stylesheets
      • templateDependencies
    • Methods
      • CloneTree()
      • CloneTree(String)
      • CloneTree(VisualElement)
      • CloneTree(VisualElement, out Int32, out Int32)
      • Instantiate()
      • Instantiate(String)
    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