07 — Reusing and Exporting

Dropping the kit into any project

  1. Import UIToolkitStarterKit.unitypackage (Assets → Import Package → Custom Package).
  2. Tools → UI Toolkit Starter Kit → Create Sample HUD In Current Scene.
  3. Replace the demo model: point HUDController at 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

Exporting your own .unitypackage (for students: submitting work)

  1. In the Project window, select the folder(s) to share — e.g. Assets/UIToolkitStarterKit or your own Assets/MyHUD.
  2. Right-click → Export Package…
  3. Leave Include dependencies checked, verify the file list, Export.
  4. The resulting .unitypackage is 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

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