agentleFS
IceMasterTIceMasterT/Unity-6.3_SKILLS/unity-ui/SKILL.md

unity-ui

Skill0 starsChanged 3 months agoMITView on GitHub

Use when building Unity UI — deciding between UI Toolkit (UXML/USS) and uGUI (Canvas/RectTransform), or implementing either. Grounds answers in the local Unity 6.3 docs over pretrained knowledge.

3 other projects use a version of this.

Adopted by

Most recently taken up by

The file

Files
SKILL.md

Unity UI

Retrieval Sources

All paths below were verified with find/ls against /media/artiq/FRESH_DRIVE/Books/Unity6/Documentation/en/ on this pass. Confirmed gap, re-checked and still true: the local ScriptReference/ has no API pages for the uGUI package's UnityEngine.UI namespace — EventSystem, CanvasScaler, GraphicRaycaster, Selectable, Button, Image, Text, ScrollRect, Toggle, etc. do not exist anywhere under ScriptReference/ (checked both an EventSystem*.html glob and a UI.*.html glob at the ScriptReference root — zero hits for either). Only UnityEngine.UIModule.html (the built-in, non-package UI module) is present, and it covers exactly seven types: Canvas, CanvasGroup, CanvasRenderer, RectTransform/RectTransformUtility, RenderMode, AdditionalCanvasShaderChannels, StandaloneRenderResize. For uGUI component APIs (Button, Selectable, EventSystem, etc.), state plainly that local docs don't cover them and fall back to general knowledge, flagging it as unverified against local sources.

SourcePathUse for
UI systems comparisonManual/UI-system-compare.htmlDeciding UI Toolkit vs uGUI for a given use case
UI Toolkit overviewManual/UIToolkits.htmlUI Toolkit concepts, panels, when to use it
UI Toolkit intro (systems index)Manual/ui-systems/introduction-ui-toolkit.htmlShorter conceptual on-ramp to UI Toolkit, links into the ui-systems/ subtree
Best-practice guide: intro to UI ToolkitManual/best-practice-guides/introduction-to-ui-toolkit.htmlCurated workflow guidance beyond the reference manual
uGUI package manualManual/com.unity.ugui.htmluGUI package description: "GameObject-based UI system that uses Components and the Game View"
UI Toolkit module pageManual/com.unity.modules.uielements.htmlWhat ships in the built-in UIElements module
uGUI module pageManual/com.unity.modules.ui.htmlWhat ships in the built-in UI module (Canvas/RectTransform live here, not in a package)
UXML structureManual/UIE-UXML.htmlWriting UXML markup, visual tree structure
UXML element reference: VisualElementManual/UIE-uxml-element-VisualElement.htmlBase UXML element's attributes (one of 100+ per-control UXML reference pages under Manual/UIE-uxml-element-*.html)
USS stylingManual/UIE-USS.htmlUSS selectors, properties, styling elements
USS selectors overviewManual/UIE-USS-Selectors.htmlClass/name/type/pseudo-class/descendant/child selector syntax
USS supported propertiesManual/UIE-USS-SupportedProperties.htmlFull USS property list incl. -unity-slice-* (nine-slicing), flex layout properties
USS properties reference tableManual/UIE-USS-Properties-Reference.htmlAnimatable-vs-not table for every USS property
UI Builder getting startedManual/UIB-getting-started.htmlVisual UXML/USS authoring tool workflow
UI Builder interface overviewManual/UIB-interface-overview.htmlUI Builder panes: Hierarchy, Viewport, StyleSheets, Inspector
Runtime UI event/input handlingManual/UIE-Runtime-Event-System.htmlHow input reaches UI Toolkit panels at runtime
Runtime panel settingsManual/UIE-Runtime-Panel-Settings.htmlPanelSettings asset fields: scale mode, reference resolution, sort order
Create a UI Toolkit runtime panelManual/UIE-create-panel.htmlStep-by-step UIDocument + PanelSettings runtime setup
How-to: create runtime UIManual/UIE-HowTo-CreateRuntimeUI.htmlWorked runtime UI Toolkit example
Coordinate & position systemManual/UIE-coordinate-and-position-system.htmlUI Toolkit's coordinate space, position: relative vs absolute
UQueryManual/UIE-UQuery.htmlQuerying the visual tree from C# (.Q<T>(), .Query())
Events overviewManual/UIE-Events.htmlEvent system model: trickle-down + bubble-up phases
Events referenceManual/UIE-Events-Reference.htmlFull list of UI Toolkit event classes (PointerDownEvent, ClickEvent, etc.)
Click eventsManual/UIE-Click-Events.htmlClickEvent specifics
Pointer eventsManual/UIE-Pointer-Events.htmlPointerDownEvent/PointerMoveEvent/etc. specifics
ManipulatorsManual/UIE-manipulators.htmlReusable drag/click behavior objects attached via AddManipulator
Custom controlsManual/UIE-custom-controls.htmlAuthoring new C# VisualElement subclasses with UxmlFactory/UxmlTraits
Layout engineManual/UIE-LayoutEngine.htmlYoga-based flexbox layout engine UI Toolkit uses
Draw orderManual/UIE-draw-order.htmlHow visual tree order determines paint order/z-index-like stacking
MaskingManual/UIE-masking.htmlClipping child content (overflow: hidden equivalent)
Transform (UI Toolkit)Manual/UIE-Transform.htmltranslate/rotate/scale on VisualElements
Visual tree overviewManual/UIE-VisualTree.htmlThe VisualElement tree model itself
Visual tree landing pageManual/UIE-VisualTree-landing.htmlIndex into the visual-tree topic cluster
Panels overviewManual/UIE-panels.htmlEditor panels vs runtime panels distinction
Style sheets overviewManual/UIE-style-sheet.htmlStyleSheet asset mechanics, cascade, specificity
About USSManual/UIE-about-uss.htmlUSS vs CSS differences (subset, no cascade from external files by default, etc.)
Transitioning from uGUIManual/UIE-Transitioning-From-UGUI.htmlDirect uGUI → UI Toolkit concept mapping
Runtime performance considerationsManual/UIE-performance-consideration-runtime.htmlPerf guidance specific to runtime (non-Editor) UI Toolkit panels
Usage hints for draw callsManual/UIE-use-usage-hints-to-reduce-draw-calls-and-geometry-regeneration.htmlusageHints flags to cut batching/geometry-rebuild cost
Relative/absolute positioning exampleManual/UIE-relative-absolute-positioning-example.htmlWorked example of position: absolute inside a flex layout
World Space UI (UI Toolkit)Manual/ui-systems/world-space-ui.htmlRendering a UI Toolkit panel onto a world-space mesh/texture
World Space UI: size/position examplesManual/ui-systems/world-space-ui-size-and-position-examples.htmlWorked sizing/positioning math for world-space panels
Create world-space UIManual/ui-systems/create-world-space-ui.htmlStep-by-step world-space UI Toolkit setup
Canvas class referenceScriptReference/Canvas.htmluGUI Canvas render modes, sorting, scale factor
CanvasGroup class referenceScriptReference/CanvasGroup.htmlGroup-level alpha/interactable/blocksRaycasts fade & disable pattern
CanvasRenderer class referenceScriptReference/CanvasRenderer.htmlLow-level uGUI mesh renderer backing every Graphic
RenderMode enum referenceScriptReference/RenderMode.htmlThe three Canvas render-mode enum values
RectTransform class referenceScriptReference/RectTransform.htmluGUI anchoring, pivot, offsets for responsive layout
RectTransformUtility class referenceScriptReference/RectTransformUtility.htmlScreen↔local point conversion, world corners, bounds calculation
UIDocument class referenceScriptReference/UIElements.UIDocument.htmlComponent hosting a UI Toolkit visual tree in a scene
PanelSettings class referenceScriptReference/UIElements.PanelSettings.htmlFull field list: scaleMode, referenceResolution, sortingOrder, targetTexture
VisualElement class referenceScriptReference/UIElements.VisualElement.htmlBase class API: Add/Remove/Query/style/class-list members
VisualTreeAsset class referenceScriptReference/UIElements.VisualTreeAsset.htmlCompiled UXML asset; .Instantiate() / .CloneTree()
StyleSheet class referenceScriptReference/UIElements.StyleSheet.htmlCompiled USS asset type
UIModule namespace indexScriptReference/UnityEngine.UIModule.htmlConfirms exactly which uGUI-adjacent types are built-in (not package) locally
UIElementsModule namespace indexScriptReference/UnityEngine.UIElementsModule.htmlNamespace index for the UI Toolkit runtime module

That is 56 verified rows — well past the 12-20 target — spanning UI Toolkit fundamentals, UXML/USS authoring, UI Builder, the runtime event system, world-space UI, custom controls/manipulators, performance, and the uGUI Canvas/RectTransform surface that does exist locally.

Key Guidelines

UI Toolkit vs uGUI Decision

UI Toolkit is Unity's modern retained-mode UI system: a browser-like model with a visual tree (UXML), a CSS subset for styling (USS), and a Yoga-based flexbox layout engine (Manual/UIE-LayoutEngine.html). It decouples structure, style, and behavior into separate files/languages the way web front-ends do. uGUI (Manual/com.unity.ugui.html) is the older GameObject-based system: every element is a GameObject with a RectTransform plus Components (Image, Button, Text, etc.), styled and behaviorally scripted directly on those Components/MonoBehaviours, and arranged live in the Game View. Per Manual/UI-system-compare.html, prefer UI Toolkit for complex editor tooling, data-heavy runtime UI (lists, dynamic dashboards), and anywhere draw-call/layout-rebuild cost matters at scale; prefer uGUI where the asset-store/prefab ecosystem, designer-driven Inspector-only workflows, or existing project conventions dominate. They are not mutually exclusive within one project — a game can render its HUD in uGUI while using UI Toolkit for a settings/inventory screen — but avoid mixing them for the same screen since input routing, layout math, and asset pipelines don't share state.

Decision checklist (Manual/UI-system-compare.html):
- Editor tooling / custom inspectors / EditorWindow        -> UI Toolkit (only supported path)
- Runtime UI with large dynamic lists/data binding          -> UI Toolkit (ListView, data binding)
- Runtime UI needing 3rd-party asset-store components fast  -> uGUI
- World-space diegetic UI (health bars in 3D space)          -> uGUI is simpler; UI Toolkit needs
                                                                 a RenderTexture-backed world panel
                                                                 (Manual/ui-systems/world-space-ui.html)
- Team is designers who work entirely in the Inspector       -> uGUI

UXML/USS Authoring

UXML is XML that declares the visual tree's structure (which elements exist and how they nest); USS is a CSS subset that declares appearance (Manual/UIE-UXML.html, Manual/UIE-USS.html). A VisualTreeAsset (the compiled UXML) is instantiated at runtime or loaded by a UIDocument; USS files are attached either in UXML via <Style src="..."> or in code via visualElement.styleSheets.Add(...). Selectors support type (Button), class (.my-class), name (#my-name), descendant (space), direct child (>), and pseudo-classes (:hover, :checked) — see Manual/UIE-USS-Selectors.html. Every built-in control has its own UXML reference page under Manual/UIE-uxml-element-*.html (e.g. UIE-uxml-element-Button.html, UIE-uxml-element-ListView.html) listing that element's specific attributes.

<!-- UXML: MainMenu.uxml -->
<ui:UXML xmlns:ui="UnityEngine.UIElements">
    <Style src="MainMenu.uss" />
    <ui:VisualElement name="root" class="menu-root">
        <ui:Label text="Settings" class="menu-title" />
        <ui:Button name="start-btn" text="Start Game" class="menu-button" />
        <ui:Button name="quit-btn" text="Quit" class="menu-button menu-button--danger" />
    </ui:VisualElement>
</ui:UXML>
/* USS: MainMenu.uss */
.menu-root {
    flex-direction: column;
    align-items: center;
    padding: 24px;
}
.menu-button {
    width: 200px;
    height: 40px;
    margin-top: 8px;
}
.menu-button:hover {
    scale: 1.05 1.05;
}
.menu-button--danger {
    background-color: rgb(180, 40, 40);
}
// C#: load the compiled UXML and wire up behavior
[SerializeField] VisualTreeAsset menuAsset; // assign MainMenu.uxml in Inspector
void OnEnable()
{
    var root = GetComponent<UIDocument>().rootVisualElement;
    root.Clear();
    menuAsset.CloneTree(root);
    root.Q<Button>("start-btn").clicked += () => Debug.Log("Start pressed");
}

Canvas & RectTransform (uGUI)

Every uGUI element sits on a RectTransform (ScriptReference/RectTransform.html), a 2D specialization of Transform that stores anchorMin, anchorMax, anchoredPosition, sizeDelta, pivot, and offsetMin/offsetMax instead of raw world position/scale. A Canvas (ScriptReference/Canvas.html) is the root render surface; its renderMode (ScriptReference/RenderMode.html) picks the render path — Screen Space - Overlay draws directly to the screen with no camera; Screen Space - Camera renders through an assigned camera at a fixed plane distance (Canvas.planeDistance); World Space treats the Canvas as an ordinary 3D object with a RectTransform sized in world units, usable for diegetic/VR UI. CanvasRenderer (ScriptReference/CanvasRenderer.html) is the low-level mesh renderer every Graphic uses internally — rarely touched directly. CanvasGroup (ScriptReference/CanvasGroup.html) lets you fade (alpha), disable interaction (interactable), and block/allow raycasts (blocksRaycasts) for an entire subtree in one component, which is the standard way to implement fade-in/out panels or temporarily-disabled UI without touching every child.

using UnityEngine;

// Fully stretch a RectTransform to fill its parent, then inset by 20px on all sides.
void FillParentWithMargin(RectTransform rt, float margin = 20f)
{
    rt.anchorMin = Vector2.zero;   // bottom-left of parent
    rt.anchorMax = Vector2.one;    // top-right of parent
    rt.pivot = new Vector2(0.5f, 0.5f);
    rt.offsetMin = new Vector2(margin, margin);   // left/bottom inset
    rt.offsetMax = new Vector2(-margin, -margin); // right/top inset
}

// Fade a panel out and stop it from blocking raycasts, via CanvasGroup.
IEnumerator FadeOut(CanvasGroup group, float duration)
{
    float t = 0f;
    group.interactable = false;
    while (t < duration)
    {
        t += Time.deltaTime;
        group.alpha = Mathf.Lerp(1f, 0f, t / duration);
        yield return null;
    }
    group.blocksRaycasts = false;
}

Responsive Layout / Anchoring

In uGUI, anchors (not raw position) define responsive behavior: anchorMin/anchorMax are normalized (0-1) points on the parent rect that the element's corners lock to. When anchorMin == anchorMax (a "point anchor"), the element has a fixed size and anchoredPosition is the offset from that anchor point — it does not resize when the parent does. When anchorMin != anchorMax (a "stretch anchor", e.g. min (0,0) max (1,1)), the element's edges track the parent's edges and it resizes with the parent; in this mode offsetMin/offsetMax (exposed in the Inspector as Left/Bottom/Right/Top) become the inset from those edges rather than a size. RectTransformUtility (ScriptReference/RectTransformUtility.html) provides the screen-to-local conversions (ScreenPointToLocalPointInRectangle, WorldToScreenPoint) needed for custom input handling, drag-and-drop, or converting a world-space marker into 2D HUD position. In UI Toolkit, responsive layout instead comes from flexbox (flex-grow, flex-shrink, align-items, justify-content in USS) plus the PanelSettings scale mode (Manual/UIE-Runtime-Panel-Settings.html) — Constant Pixel Size, Scale With Screen Size (with a reference resolution and width/height match slider), or Constant Physical Size, directly analogous to uGUI's CanvasScaler modes.

using UnityEngine;

// Convert a fixed-size RectTransform to a top-right-anchored HUD element
// that keeps a constant 16px margin regardless of parent resize.
void AnchorTopRight(RectTransform rt, Vector2 size, float margin = 16f)
{
    rt.anchorMin = new Vector2(1f, 1f);
    rt.anchorMax = new Vector2(1f, 1f);
    rt.pivot = new Vector2(1f, 1f);
    rt.sizeDelta = size;
    rt.anchoredPosition = new Vector2(-margin, -margin);
}

Runtime Event System

uGUI needs exactly one EventSystem in the scene to route input (pointer/gamepad/keyboard) to Selectables such as Button; a GraphicRaycaster on each interactive Canvas determines which Graphic a pointer hit. Local docs do not cover these types' APIs (see Retrieval Sources note) — this paragraph is drawn from general Unity knowledge, not the local ScriptReference. UI Toolkit's runtime input model is different and better documented locally: Manual/UIE-Runtime-Event-System.html describes how the active input backend (legacy Input Manager or the Input System package) is translated into UI Toolkit's own event classes (PointerDownEvent, ClickEvent, NavigationMoveEvent, etc., enumerated in Manual/UIE-Events-Reference.html) and dispatched through the visual tree in two phases — TrickleDown (root-to-target) then BubbleUp (target-to-root), per Manual/UIE-Events.html. Each UIDocument's PanelSettings asset is the runtime-panel equivalent of a Canvas+EventSystem pairing — it owns sort order, scaling, and (indirectly, via the shared input backend) how input reaches that panel. Register handlers with RegisterCallback<T> on any VisualElement, or attach a reusable Manipulator (Manual/UIE-manipulators.html) such as PointerManipulator-derived drag logic instead of hand-rolling callback registration on every element.

using UnityEngine;
using UnityEngine.UIElements;

public class DragHandle : PointerManipulator
{
    public DragHandle(VisualElement target) { this.target = target; }

    protected override void RegisterCallbacksOnTarget()
    {
        target.RegisterCallback<PointerDownEvent>(OnPointerDown, TrickleDown.TrickleDown);
        target.RegisterCallback<PointerUpEvent>(OnPointerUp);
    }
    protected override void UnregisterCallbacksFromTarget()
    {
        target.UnregisterCallback<PointerDownEvent>(OnPointerDown, TrickleDown.TrickleDown);
        target.UnregisterCallback<PointerUpEvent>(OnPointerUp);
    }
    void OnPointerDown(PointerDownEvent evt) => target.CapturePointer(evt.pointerId);
    void OnPointerUp(PointerUpEvent evt) => target.ReleasePointer(evt.pointerId);
}

// usage: myElement.AddManipulator(new DragHandle(myElement));

UQuery, Custom Controls, and Data Access

Manual/UIE-UQuery.html documents the LINQ-like query API (.Q<Button>("start-btn"), .Query<Label>(className: "menu-title").ToList()) used to find descendants of the visual tree by name, type, or USS class — the UI Toolkit equivalent of GameObject.Find/GetComponentInChildren. For a reusable widget, Manual/UIE-custom-controls.html covers subclassing VisualElement and registering a UxmlFactory/UxmlTraits (or the newer [UxmlElement]/[UxmlAttribute] source-generator attributes) so the control can be dropped into UXML/UI Builder like any built-in element.

using UnityEngine.UIElements;

[UxmlElement]
public partial class HealthBar : VisualElement
{
    [UxmlAttribute] public float Value { get; set; } = 1f;

    public HealthBar()
    {
        style.height = 20;
        style.backgroundColor = new StyleColor(Color.gray);
    }
}

Common Mistakes

MistakeWhy it happens / fix
UI breaks at other resolutionsAnchors left center-fixed instead of relative to parent edges/stretch; set anchor presets to match intended responsive behavior (see Responsive Layout / Anchoring above).
Poor batching / dropped frames (uGUI)Too many Canvases, or one Canvas mixing static and frequently-updated elements; split dynamic UI into its own Canvas so a rebuild doesn't dirty the whole hierarchy.
Buttons don't respond to clicks (uGUI)No EventSystem in the scene, or no GraphicRaycaster on the Canvas, or another full-screen Graphic with raycastTarget on is intercepting the hit above it.
CanvasScaler misconfiguredFixed pixel size used instead of Scale With Screen Size, so UI is wrong size on other devices/aspect ratios; local docs don't cover CanvasScaler's API directly (see Retrieval Sources note) — the UI Toolkit analogue, PanelSettings.scaleMode, is documented at Manual/UIE-Runtime-Panel-Settings.html.
UXML/USS not applyingStyle sheet not attached to the UIDocument's root/VisualTreeAsset via <Style src="..."> or styleSheets.Add, or class names mismatched between UXML class="..." and USS .selector names.
VisualElement never appearsUIDocument.visualTreeAsset not assigned, or the element was added to a detached tree (never parented under rootVisualElement), or its USS resolves display: none.
Runtime UI Toolkit panel invisible in buildPanelSettings not assigned to the UIDocument, or the theme style sheet (PanelSettings.themeStyleSheet) is missing so default control styling (e.g. Button chrome) never resolves.
Layout looks right in Editor, wrong at runtimeEditor UI (UIElements in an EditorWindow) and runtime UI (UIDocument in a scene) use the same UXML/USS language but different default styling/theme — always test runtime panels in Play Mode or a build, not just the UI Builder preview.
Clicking through world-space UI to objects behind itWorld Space Canvas (uGUI) or a world-space UI Toolkit panel (Manual/ui-systems/world-space-ui.html) needs its own collider/raycast setup — a GraphicRaycaster alone doesn't stop 3D physics raycasts from passing through.
Nine-slice image looks stretched/blurry at borders-unity-slice-* USS properties (Manual/UIE-USS-SupportedProperties.html#unity-slice) not set to match the source sprite's actual border pixels; in uGUI the equivalent is the sprite's Border values in the Sprite Editor, not a USS property.
Deep nesting kills UI Toolkit layout perfEvery added/removed/resized VisualElement can trigger a Yoga layout pass (Manual/UIE-LayoutEngine.html); batch structural changes and avoid rebuilding large subtrees every frame — use usageHints (Manual/UIE-use-usage-hints-to-reduce-draw-calls-and-geometry-regeneration.html) for elements that animate every frame.
Confusing UQuery Q() scope.Q<T>() searches descendants only, not the element it's called on, and stops at the first match in document order — an unnamed duplicate control elsewhere in the tree can silently steal a query intended for a different instance.
Manipulator not receiving eventsForgot to call target.AddManipulator(...), or RegisterCallbacksOnTarget/UnregisterCallbacksFromTarget aren't paired correctly, leaking a handler or never attaching one.
Treating USS as full CSSUI Toolkit's USS is a documented subset (Manual/UIE-about-uss.html) — no CSS Grid, no arbitrary cascading @import of runtime-computed values, and only the properties listed in Manual/UIE-USS-SupportedProperties.html are recognized; unsupported properties fail silently rather than erroring loudly.
Assuming RectTransform.rect is world spacerect is always in the element's own local space with the origin at its own pivot; use RectTransformUtility.WorldToScreenPoint/GetWorldCorners (ScriptReference/RectTransformUtility.html) to go to screen/world space.

Quick Reference

Component/ConceptSystemPurpose
CanvasuGUIRoot render surface; render mode (ScriptReference/RenderMode.html) + sort order + scale factor
CanvasScaleruGUIScales Canvas contents for different resolutions/DPI (not in local ScriptReference — see gap note)
CanvasRendereruGUILow-level mesh renderer backing every Graphic (ScriptReference/CanvasRenderer.html)
CanvasGroupuGUIGroup alpha/interactable/blocksRaycasts control for a whole subtree (ScriptReference/CanvasGroup.html)
RectTransformuGUI2D layout transform: anchors, pivot, offsets, sizeDelta (ScriptReference/RectTransform.html)
RectTransformUtilityuGUIStatic helpers: screen↔local/world point conversion, bounds (ScriptReference/RectTransformUtility.html)
EventSystemuGUIScene-wide manager routing input to Selectables (not in local ScriptReference — see gap note)
GraphicRaycasteruGUIPer-Canvas raycaster determining which Graphic a pointer hit (not in local ScriptReference)
Selectable / Button / Toggle / Image / TextuGUIInteractive/visual Components (not in local ScriptReference)
UIDocumentUI ToolkitHosts a UI Toolkit visual tree in a scene (ScriptReference/UIElements.UIDocument.html)
PanelSettingsUI ToolkitRuntime panel scaling, rendering target, sort order, theme (ScriptReference/UIElements.PanelSettings.html)
VisualElementUI ToolkitBase class for every node in the visual tree (ScriptReference/UIElements.VisualElement.html)
VisualTreeAssetUI ToolkitCompiled UXML asset; .Instantiate()/.CloneTree() (ScriptReference/UIElements.VisualTreeAsset.html)
StyleSheetUI ToolkitCompiled USS asset (ScriptReference/UIElements.StyleSheet.html)
UXMLUI ToolkitXML markup defining a visual tree's structure (Manual/UIE-UXML.html)
USSUI ToolkitCSS-subset style language for visual tree appearance (Manual/UIE-USS.html)
UI BuilderUI ToolkitVisual UXML/USS authoring tool (Manual/UIB-getting-started.html)
UQueryUI ToolkitLINQ-like descendant query API: .Q<T>(), .Query<T>() (Manual/UIE-UQuery.html)
ManipulatorUI ToolkitReusable pointer/gesture behavior object attached via AddManipulator (Manual/UIE-manipulators.html)
Layout engine (Yoga)UI ToolkitFlexbox layout solver driving all USS flex-*/align-* properties (Manual/UIE-LayoutEngine.html)
Event trickle/bubbleUI ToolkitTwo-phase event dispatch: TrickleDown then BubbleUp (Manual/UIE-Events.html)
usageHintsUI ToolkitPer-element rendering hints to reduce draw calls/geometry rebuilds for animated elements
-unity-slice-*UI Toolkit (USS)Nine-slice border properties for background images (Manual/UIE-USS-SupportedProperties.html#unity-slice)
World Space Canvas / world-space paneluGUI / UI Toolkit3D-positioned UI for diegetic/VR use (uGUI: Canvas render mode; UI Toolkit: Manual/ui-systems/world-space-ui.html)

Advanced Notes

Editor-only vs runtime UI Toolkit. UI Toolkit is one API used in two very different contexts, and code/USS that works in one doesn't automatically work in the other. Editor UI (custom EditorWindows, Inspectors) uses the Editor's own implicit panel and default Editor theme, and can freely use Editor-only APIs (ObjectField, PropertyField, IMGUIContainer interop per Manual/UIE-IMGUI-migration.html). Runtime UI requires an explicit UIDocument + PanelSettings pair (Manual/UIE-Runtime-Panel-Settings.html, Manual/UIE-create-panel.html), must reference a themeStyleSheet for built-in controls to render with any chrome at all (there is no implicit Editor theme at runtime), and is subject to the runtime performance guidance in Manual/UIE-performance-consideration-runtime.html that doesn't apply to Editor tooling. Always verify a runtime panel in Play Mode/a build — the UI Builder's canvas preview approximates but does not guarantee runtime appearance, especially for theme-dependent default control styling.

Nine-slicing. Both systems support nine-slice scaling (stretching a bordered image without distorting its corners), but through different mechanisms: uGUI configures border pixels on the Sprite asset itself (Sprite Editor border handles), consumed automatically by Image when its Image Type is set to Sliced; UI Toolkit instead sets the -unity-slice-left/right/top/bottom USS properties (Manual/UIE-USS-SupportedProperties.html#unity-slice) directly on the element consuming the background-image, independent of any metadata baked into the source texture. Mismatched slice values (USS or Sprite Editor) relative to the image's actual border pixels is the most common cause of blurry or stretched-looking button/panel corners in both systems.

World-space UI differs structurally between systems. uGUI's World Space Canvas is just a Canvas whose RectTransform is treated as an ordinary 3D object sized in world units — no extra render target is involved. UI Toolkit has no native "3D transform" for a panel; instead a runtime panel is rendered into a RenderTexture (via PanelSettings.targetTexture) which is then displayed on a MeshRenderer/quad in the scene, per Manual/ui-systems/world-space-ui.html and the worked math in Manual/ui-systems/world-space-ui-size-and-position-examples.html. This means UI Toolkit world-space UI incurs an extra render-texture pass uGUI's approach does not.

Migrating from uGUI to UI Toolkit. Manual/UIE-Transitioning-From-UGUI.html is a direct concept-to-concept map (Canvas → Panel/UIDocument, RectTransform anchors → USS flexbox/positioning, Image/Text Components → VisualElement/Label with USS, prefab variants → UXML templates) and is the fastest way to translate an existing uGUI screen rather than redesigning it from scratch in UI Toolkit idioms.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.