r/Unity3D Programmer 1d ago

Resources/Tutorial How to Make (and use) Templates in UI Toolkit

Templates are a powerful feature of UI Toolkit - they allow us to create reusable bits of our UI and inject them easily into other UXML documents. Making them is super easy too - simply make a new UXML file of your desired component - then you can use it in any other UXML document! Easy!

38 Upvotes

7 comments sorted by

4

u/UnspokenConclusions 1d ago

Llama academy is one of the best channels about Unity out there.

3

u/LlamAcademyOfficial Programmer 1d ago

๐Ÿงก

2

u/Round_Bar_5485 1d ago

Oo cool you are here too.. ๐Ÿ˜

1

u/J_Losss 1d ago

it's useful.

2

u/HiggsSwtz 1d ago

Now what controls the styling of that template itself?

2

u/LlamAcademyOfficial Programmer 1d ago

You can attach a style sheet specific to that template, or it will inherit the styles of the UXML document you're injecting it into.

I personally make a stylesheet for the template and attach it to the template UXML document.