Luna UI's responsive system applies a breakpoint USS class (e.g. .breakpoint-lg) to the root of every registered UIView from one call. Author breakpoint-prefixed style rules in your USS, then drive the active breakpoint at runtime — your settings UI, an aspect-ratio listener, or a manual button all use the same API.
Assets > Create > CupkekGames/Luna UI/Responsive Switcher. This produces a ResponsiveViewStyleSwitcher SO.LunaUIManager — assign the SO to the Responsive Switcher field on your scene's LunaUIManager component. (Empty by default; the system is a no-op until wired.).my-card { width: 100%; }
.breakpoint-md .my-card { width: 50%; }
.breakpoint-lg .my-card { width: 33%; }LunaUIManager.Instance.ResponsiveSwitcher.SetBreakpoint("lg");
// → adds `.breakpoint-lg` to every UIView's rootPass empty / null to clear: SetBreakpoint(""). Switching swaps the class cleanly — the previous breakpoint class is removed before the new one is added.
ResponsiveViewStyleSwitcher is a project-wide ScriptableObject. It tracks the currently-applied breakpoint name and dispatches add/remove calls to LunaUIManager.AddClassToAllUIViews / RemoveClassFromAllUIViews._breakpointClassPrefix, default breakpoint-). Change it once per project; call sites pass just the suffix (lg, md, etc.).BreakpointChanged to react to switches:
switcher.BreakpointChanged += name => Debug.Log($"now at {name}");[NonSerialized] — a fresh play session starts with no class applied, so leftover state from a previous session can't desync the live views.The prefix + suffix combination is open. Two common patterns:
| Pattern | Example USS | When |
|---|---|---|
| Tailwind-style | .breakpoint-sm, .breakpoint-md, .breakpoint-lg, .breakpoint-xl, .breakpoint-2xl | Want familiar mental model; mirrors web. |
| Device-class | .breakpoint-mobile, .breakpoint-tablet, .breakpoint-desktop | Care about device categories more than exact widths. |
The package doesn't enforce either — you choose the suffixes that make sense for your game.
The switcher is decoupled from what decides the breakpoint. Wire it to whichever signal fits:
SetBreakpoint.Application.isMobilePlatform or your own probe.SetBreakpoint in scene-load logic for fixed-layout scenes.The Showcase sample includes ResponsiveDemo (Components/ResponsiveDemo/Scenes/ResponsiveDemo.unity). It exercises the full xs / sm / md / lg / xl / 2xl Tailwind-style ladder with control-bar buttons and a simulated-viewport preview. The driving controller is ResponsiveDemoController.cs.
The flagship FullScreenExamples demo (GameUiHub) also drives breakpoints to switch its tab/modal layout responsively.
GridView responsive variants — GridView/ListView/ListViewResponsiveDemo and GridView/Pagination/PaginationResponsiveDemo — show how list/grid layouts pick up breakpoint classes for column-count changes.
// Singleton SO (assigned on LunaUIManager)
public class ResponsiveViewStyleSwitcher : ScriptableObject
{
public string CurrentBreakpoint { get; } // empty string when none
public event Action<string> BreakpointChanged; // fires on every change
public void SetBreakpoint(string breakpointName); // pass "" / null to clear
}The class prefix and current breakpoint live on the SO; the rest of the work is plain UIView class management. There is no per-frame cost — work happens only on SetBreakpoint calls.
Settings
Theme
Light
Contrast
Material
Dark
Dim
Material Dark
System
Sidebar(Light & Contrast only)
Font Family
DM Sans
Wix
Inclusive Sans
AR One Sans
Direction