t1k:unity:ui:toolkit
| Field | Value |
|---|---|
| Module | ui |
| Version | 2.3.1 |
| Effort | medium |
| Tools | — |
Keywords: UI, UI Toolkit, unity, UXML
How to invoke
Section titled “How to invoke”/t1k:unity:ui:toolkitUnity UI Toolkit — UXML, USS & Runtime UI
Section titled “Unity UI Toolkit — UXML, USS & Runtime UI”UI Toolkit reference for Unity 6. Preferred over UGUI (Canvas) for new UI. For game HUD with world-space needs, Canvas may still be better.
When to Use What
Section titled “When to Use What”| Feature | UI Toolkit | UGUI (Canvas) |
|---|---|---|
| Editor UI | Yes | No |
| Runtime menus/HUD | Yes | Yes |
| World-space UI | Limited | Yes (preferred) |
| Data binding | Built-in | Manual |
| Performance | Better (retained mode) | Immediate mode batching |
- Create Panel Settings asset: Assets → Create → UI Toolkit → Panel Settings
- Create UXML document: Assets → Create → UI Toolkit → UI Document
- Add
UIDocumentcomponent to GameObject → assign Panel Settings + UXML
Key Gotchas
Section titled “Key Gotchas”- Q() returns null: Element not found — check name/type spelling, ensure UXML loaded
- Styles not applying: USS must be referenced in UXML via
<Style src="...">orstyleSheets.Add() - World-space UI: Supported via
PanelSettings.panel3DPositionbut Canvas is more mature - Font: Use
-unity-font-definitionfor TextMeshPro fonts in USS - Picking mode: Set
pickingMode = PickingMode.Ignoreon overlay elements that shouldn’t block clicks
→ Full UXML structure, USS examples, C# querying/events, runtime creation, ListView binding, all controls: references/uxml-uss-and-patterns.md
Related Skills & Agents
Section titled “Related Skills & Agents”unity-localization— Localized UI stringsunity-input-system— UI navigation inputunity-addressables— Loading UI assets on demand
Reference Files
Section titled “Reference Files”| File | Contents |
|---|---|
| uxml-uss-and-patterns.md | UXML structure, USS styling, C# query/events, runtime creation, ListView, all controls, gotchas |