unity-ui-procedural
Unity UI Toolkit Procedural UI
Build lightning-fast, highly dynamic user interfaces entirely through code. This skill enables the "Logic-First" UI workflow, perfect for complex systems like inventories, tooltips, and dynamic HUDs.
Core Features
- Fluent Hiyerarşi Construction: Use chained extension methods like
.CreateChild<T>()and.WithClass()to build UI trees that read like documentation. - Generic Pointer Manipulators: Decouple interaction logic (Drag, Resize, Selection) from visuals using the
ManipulatorAPI. - No-Builder Workflow: Eliminates the need for complex UXML files, making UI version-control friendly and procedurally scalable.
- BEM Integration: Extension methods prioritize CSS class application to maintain a clean styling system.
Core Files (Max 3)
UIToolkitExtensions.cs.txt: Generic methods for chaining element creation and styling.DragManipulator.cs.txt: A cross-platform pointer-based drag system for any VisualElement.ProceduralViewExample.cs.txt: A "Hotbar/Inventory" demo showing the power of the fluent syntax.
Usage
1. Build a Panel (The Fluent Way)
var root = GetComponent<UIDocument>().rootVisualElement;
root.CreateChild<VisualElement>( "main-menu" )
.WithClass( "menu--active" )
.CreateChild<Button>( "menu__btn--start" )
.text = "Start Game";
2. Add Interactions
var window = root.Q( "inventory-window" );
window.AddManipulator( new DragManipulator() );
Key Principle
Always use USS classes for styling even when building procedurally. Avoid setting .style.width or colors directly in C# unless it is for dynamic calculations (like health bars).
More from muharremtozan/unity-agent-skills
unity-so-prefab-manager
Manages the structured relationship between ScriptableObjects (Data) and Prefabs (Logic/Visuals) in Unity 6. Follows the 'SO-to-Mono' Bridge pattern to ensure instance independence (e.g., individual health for identical robots) while maintaining a clean, data-driven architecture. Use when: (1) Creating new unit/item types, (2) Wiring SO data to Prefab MonoBehaviours, (3) Resolving data-sharing bugs where changing one SO affects all instances.
16unity-fsm
Specialized skill for implementing a robust, extensible Finite State Machine in Unity using the State and Strategy patterns. Based on the pattern by Adam Myhre (3D Platformer). Use when creating complex AI, player controllers, or any system requiring structured state management.
11unity-code-reviewer
Professional Unity C# Code Reviewer. Detects anti-patterns, performance leaks, and enforces project-specific architecture.
10unity-assembly-management
Manage project boundaries using Assembly Definitions (.asmdef) for faster compile times and modular architecture. Based on the patterns by Adam Myhre. Enforces responsibility-based organization and handles Runtime/Editor/Tests splits.
9unity-event-bus
Advanced code-driven event bus with reflection-based bootstrapping. Provides zero-setup global messaging.
9unity-ui-data-binding
Implementation of MVVM-style Data Binding for Unity UI Toolkit using the [CreateProperty] attribute and BindableProperty wrappers.
9