# Unity 6.3 — UI Module Reference **Last verified:** 2026-02-13 **Knowledge Gap:** Unity 6 UI Toolkit is production-ready for runtime UI --- ## Overview Unity 6 UI systems: - **UI Toolkit** (RECOMMENDED): Modern, performant, HTML/CSS-like (production-ready in Unity 6) - **UGUI (Canvas)**: Legacy system, still supported but not recommended for new projects - **IMGUI**: Editor-only, deprecated for runtime UI --- ## UI Toolkit (Modern UI) ### Setup UI Document 1. Create UXML (UI structure): - `Assets > Create > UI Toolkit > UI Document` 2. Create USS (styling): - `Assets > Create > UI Toolkit > StyleSheet` 3. Add to scene: - `GameObject > UI Toolkit > UI Document` - Assign UXML to `UIDocument > Source Asset` --- ### UXML (UI Structure) ```xml ``` --- ### USS (Styling) ```css /* MainMenu.uss */ .container { flex-direction: column; align-items: center; justify-content: center; width: 100%; height: 100%; background-color: rgb(30, 30, 30); } .title { font-size: 48px; color: white; margin-bottom: 20px; } Button { width: 200px; height: 50px; margin: 10px; font-size: 24px; } Button:hover { background-color: rgb(100, 150, 200); } ``` --- ### C# Scripting (UI Toolkit) ```csharp using UnityEngine; using UnityEngine.UIElements; public class MainMenu : MonoBehaviour { void OnEnable() { var root = GetComponent().rootVisualElement; // Query elements by name var playButton = root.Q