Documentation

Unity Engine


User Manual

Script Reference

Unity Engine


TemplateContainer

Represents the root VisualElement of UXML file.
Read time 6 minutesLast updated 2 days ago

Definition

[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

templateIdThe local ID of the template in the parent UXML file (Read Only).
templateSourceStores the template asset reference, if the generated element is cloned from a VisualTreeAsset as a Template declaration inside another VisualTreeAsset.

Inheritance

Inherited Members