Class VisualTreeAsset
An instance of this class holds a tree of VisualElementAsset
s, created from a UXML file. Each node in the file corresponds to a VisualElementAsset
. You can clone a VisualTreeAsset
to yield a tree of VisualElement
s.
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
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
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. |