TemplateContainer
Represents the root VisualElement of UXML file.
Read time 6 minutesLast updated 2 days ago
Definition
- Type: Class
- Namespace: UnityEngine.UIElements
- Assembly: UnityEngine.UIElementsModule
- Inherits from: BindableElement
- Implements: IEventHandler, IResolvedStyle, ITransform, ITransitionAnimations, IExperimentalFeatures, IVisualElementScheduler, IBindable
[UxmlElement("Instance")]public class TemplateContainer : BindableElement, IEventHandler, IResolvedStyle, ITransform, ITransitionAnimations, IExperimentalFeatures, IVisualElementScheduler, 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 VisualTreeAsset.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.
Properties
Property | Description |
|---|---|
| templateId | The local ID of the template in the parent UXML file (Read Only). |
| templateSource | Stores the template asset reference, if the generated element is cloned from a VisualTreeAsset as a Template declaration inside another VisualTreeAsset. |