This document defines the long-term product goals and the development path for SUI as a Unity-first, Razor-driven UI runtime.
Build a production-ready UI runtime in Unity that uses Razor-style markup and CSS-like styling while replacing traditional Unity UI workflows for game HUDs, menus, and in-world screens.
Game-focused hybrid model:
- Rendering/layout/input stays in SUI runtime (compiled Unity C#).
- Gameplay logic stays in regular Unity
MonoBehaviour/systems (compiled C#). - UI event bridge calls C# methods on Unity scripts directly.
- Roslyn is optional and used only for UI glue/code-behind authoring, not core gameplay loops.
Why this is the default:
- Best runtime predictability for games.
- Native access to Unity systems.
- Fast authoring without forcing full dynamic scripting.
- Clarity: players understand UI state/actions in under 2 seconds.
- Responsiveness: visible UI reaction in 1 frame (or <= 50ms perceived).
- Consistency: one design language across all screens and states.
- Reliability: no major breakage across target resolutions.
- Performance: UI stays inside frame budget in gameplay scenes.
- Authoring speed: new screen in < 1 hour, common edits in minutes.
- Razor source ingestion and parsing pipeline.
- Runtime host with bindings/actions.
- Layout with flex-direction, gap, justify-content, align-items, min/max sizing.
- Style selectors: tag, class, id, inline precedence.
- Pseudo selectors: hover, active, focus, disabled, invalid.
- Controls: input text, checkbox, radio, range, textarea, select/listbox+option, button, image, progress, meter.
- Lists: ul/ol/li.
- Shadow effects: box-shadow and text-shadow (multi-layer).
- Custom inspector for value bindings (table + bulk mode).
- Typed value bindings (
string/bool/int/float) with validation state support. - Authoring automation:
- auto-sync actions from Razor event attributes,
- auto-assign stylesheet from Razor filename,
- auto-create value bindings from
@tokensand control bindings.
- Unity menu item to create SUI Runtime Host quickly.
- Modal foundations (open/close API + backdrop + trap).
- Scroll containers + clipping.
- Positioning and z-order (
relative/absolute,z-index). - Drag/drop event system.
- MonoBehaviour event bridge (markup actions -> public
voidscript methods). - Demo pack covering current capabilities.
Make:
button,input,textarea,checkbox,radio,select/listbox,slider,progress,meter,image,list.
Done when:
- Every control has
default/hover/active/focus/disabledstyles and sample usage.
Make:
flex-grow,flex-shrink,wrap, absolute/relative positioning, scroll container.
Done when:
- One complex menu screen works at 16:9, 21:9, and 4:3 without breaking.
Make:
- border, border-radius, gradients, shadows, theme tokens.
Done when:
- We can ship a polished main menu with no Unity UI components.
Make:
- two-way value binding, radio group model, select model, validation/error state.
Done when:
- A full settings form saves/loads and updates live.
Make:
- subtree diff updates + partial layout invalidation.
Done when:
- UI updates do not full-redraw and stay within frame budget in gameplay scene.
Make:
- visual debug inspector, screen templates, hot-reload loop, lint checks.
Done when:
- New screen creation is under 1 hour and iteration is under 5 minutes.
Make:
- auto action sync from Razor events,
- auto stylesheet pairing from Razor source,
- auto value generation from
@tokensand controls, - one-click demo discovery/coverage guide.
Done when:
- Initial scene setup requires minimal manual list editing in inspector.
Make:
- modal windows with backdrop and focus/input trap,
- draggable windows (header handle, z-order bring-to-front),
- drop zones with enter/leave/over/drop events,
- scriptable animation hooks (open/close/move) and style transitions.
Done when:
- We can build an inventory/settings modal flow with dragable windows and animated open/close entirely in SUI.
- Finish Control Kit v1 state completeness (
disabledstyling/behavior path). - State + Binding v1: typed values (
string/bool/int/float) and form validation states. - Authoring Automation v1 (auto action/style/value sync + demo pack).
- Tooling v1: visual debug overlay (layout bounds, z-order, focus, scroll, drag targets).
- State + Binding v1.1: validation messages + touched/dirty state + submit gating.
- Performance pass phase 1: subtree diff + partial layout invalidation.
- Modal/Window v1.1: bring-to-front on focus, bounds clamp, close-button pattern.
- Roslyn integration adapter (optional mode) for UI code-behind only.
- Animation hooks phase 1 (
onopen/onclose/onmove) and transition primitives.
- Live hot-reload and lint checks.
- s&box compatibility aliases and migration cookbook.
- Screen templates from Unity asset menu + host/inspector quick-create flow (basic/modal/hud/settings/inventory starters).
- Use 2-week iterations.
- Each iteration includes:
- 1 feature deliverable
- 1 stabilization task
- 1 tooling/test improvement
- End each iteration with a demo scene proving "Done when" criteria progress.
- Feature documented in README support table.
- Sample updated to demonstrate feature.
- Edge-case behavior tested.
- No regression in existing sample controls.
- Build passes without new warnings/errors introduced by the feature.