07 — Reusing and Exporting
Dropping the kit into any project
- Import
UIToolkitStarterKit.unitypackage(Assets → Import Package → Custom Package). - Tools → UI Toolkit Starter Kit → Create Sample HUD In Current Scene.
- Replace the demo model: point
HUDControllerat your own health/score source, or copy its query-and-subscribe pattern into your own controller.
The USS file is the most reusable part — attach StarterKit.uss to any new UXML document and the .btn, .panel, and variable palette come along.
Making UXML reusable inside a project
- Templates: any UXML file can be instanced inside another (drag it from the Library's Project tab, or
<ui:Instance template="..."/>). Build aHealthPanel.uxmlonce, instance it for player and boss. - Custom controls: C# classes marked
[UxmlElement]become drag-and-drop Library items — the step beyond this kit (custom controls docs).
Exporting your own .unitypackage (for students: submitting work)
- In the Project window, select the folder(s) to share — e.g.
Assets/UIToolkitStarterKitor your ownAssets/MyHUD. - Right-click → Export Package…
- Leave Include dependencies checked, verify the file list, Export.
- The resulting
.unitypackageis a single file anyone can double-click to import.
What's actually in a .unitypackage?
It's a tar.gz archive where every asset travels with its GUID (Unity's permanent ID for an asset). GUIDs are why references — like this kit's UXML→USS link — survive the trip between projects. It's also why you import packages rather than copy files: copying without .meta files breaks references.
Where to go next
- Build a main menu with scene loading — stylized main menu walkthrough
- Dissect Dragon Crashers (Asset Store) — a full game HUD, menus, inventory
- ListView + data binding for inventories and leaderboards — the advanced best-practice guide covers runtime data binding, a headline Unity 6 feature
- The free e-book Create scalable and performant UI with UI Toolkit in Unity 6
You now know the full loop: structure in UXML → style and states in USS → behavior in C# → packaged for reuse. That's the same loop every screen in a shipped game goes through.
Back to 00 - Start Here