Skip to content

t1k:unity:ui:toolkit

FieldValue
Moduleui
Version2.3.1
Effortmedium
Tools

Keywords: UI, UI Toolkit, unity, UXML

/t1k:unity:ui:toolkit

Unity 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.

FeatureUI ToolkitUGUI (Canvas)
Editor UIYesNo
Runtime menus/HUDYesYes
World-space UILimitedYes (preferred)
Data bindingBuilt-inManual
PerformanceBetter (retained mode)Immediate mode batching
  1. Create Panel Settings asset: Assets → Create → UI Toolkit → Panel Settings
  2. Create UXML document: Assets → Create → UI Toolkit → UI Document
  3. Add UIDocument component to GameObject → assign Panel Settings + UXML
  1. Q() returns null: Element not found — check name/type spelling, ensure UXML loaded
  2. Styles not applying: USS must be referenced in UXML via <Style src="..."> or styleSheets.Add()
  3. World-space UI: Supported via PanelSettings.panel3DPosition but Canvas is more mature
  4. Font: Use -unity-font-definition for TextMeshPro fonts in USS
  5. Picking mode: Set pickingMode = PickingMode.Ignore on 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

  • unity-localization — Localized UI strings
  • unity-input-system — UI navigation input
  • unity-addressables — Loading UI assets on demand
FileContents
uxml-uss-and-patterns.mdUXML structure, USS styling, C# query/events, runtime creation, ListView, all controls, gotchas