Class TemplateContainer
Represents the root VisualElement of UXML file.
Inherited Members
Namespace: UnityEngine.UIElements
Syntax
public class TemplateContainer : BindableElement, IEventHandler, ITransform, ITransitionAnimations, IExperimentalFeatures, IVisualElementScheduler, IResolvedStyle, IBindable
Remarks
A TemplateContainer instance is created by Unity to represent the root of the UXML file and acts as the parent for all elements in the file. Users typically don't create TemplateContainer objects directly. When using Instantiate(), a TemplateContainer instance is returned to you to represent the root of the hierarchy. When using UXML templates, a TemplateContainer is generated for the template instance and inserted into the hierarchy of the parent UXML file.
Constructors
TemplateContainer()
Declaration
public TemplateContainer()
TemplateContainer(String)
Declaration
public TemplateContainer(string templateId)
Parameters
Type | Name | Description |
---|---|---|
String | templateId |
Properties
contentContainer
Declaration
public override VisualElement contentContainer { get; }
Property Value
Type | Description |
---|---|
VisualElement |
Overrides
templateId
The local ID of the template in the parent UXML file (RO).
Declaration
public string templateId { get; }
Property Value
Type | Description |
---|---|
String |
Remarks
This value is null, unless the TemplateContainer represents a UXML template within another UXML file.
templateSource
Stores the template asset reference, if the generated element is cloned from a VisualTreeAsset as a Template declaration inside another VisualTreeAsset.
Declaration
public VisualTreeAsset templateSource { get; }
Property Value
Type | Description |
---|---|
VisualTreeAsset |