Drop-in gamepad and keyboard navigation for Unity UI Toolkit. Spatial nav, focus groups with four boundary modes, focus memory, device-aware indicators, six demo scenes.Unity's UI Toolkit ships without an equivalent to UGUI's Navigation component. Out of the box, gamepad and keyboard focus management is effectively broken — arrow keys don't move between buttons, focus rings don't hide for mouse users, and nested menus need custom plumbing for every edge case.This asset fills that gap. Drop the included FocusManager prefab into your scene, register your focusable elements, and directional navigation works immediately.Works on day one.Spatial algorithm handles irregular layouts — mixed cell sizes, wide rows, gaps, sparse grids — no per-edge wiring. Push and pop focus groups for nested menus and modal dialogs. Focus memory restores the user to where they left off when they return to a previous group. Auto scroll-into-view keeps the focused element visible inside long ScrollViews.Device-aware focus indicator.The focus ring renders for keyboard and gamepad users but hides for mouse users automatically. Three visibility modes (Auto, AlwaysShow, AlwaysHide) let you override for accessibility or kiosk scenarios. The indicator itself is pluggable — supply your own IFocusIndicator implementation for animated rings, glow effects, or anything you like.Six demo scenes included.Basic Nav (3×3 grid starter), Grid Nav (irregular layout with wide cells), Nested Groups (push/pop with focus memory), Modal Trap (confirm dialog pattern), ScrollView (auto-scroll-into-view through a long list), and Device Switching (three indicator visibility modes shown in real time). Each demo ships with UXML, USS, controller script, and a README explaining what it shows.Works with Screen Manager.When UI Toolkit: Screen Manager is also installed, enable the integration from `Tools > KrookedLilly > Screen Manager Setup`. Each screen then owns a focus group automatically. Push or pop a screen and focus follows — Tab cycles within the active screen only, and returning to a previous screen restores focus to whichever element the user had selected. Per-screen default focus and boundary mode are one-line opt-ins:```csharpScreenManagerIntegration.SetDefaultFocus(screenId, element);ScreenManagerIntegration.SetBoundaryMode(screenId, BoundaryMode.Trap);```Works with Tween Engine.When UI Toolkit: Tween Engine is also installed, enable the integration from `Tools > KrookedLilly > Tween Engine Setup`. Then swap the default class-toggle indicator for `TweenFocusIndicator` — focused elements scale up smoothly with configurable target scale, duration, and easing. The USS class still applies, so existing border or color styling continues to work alongside the tween:```csharpfocusManager.IndicatorManager.Indicator = new TweenFocusIndicator();```Other UI Toolkit assets that consume Focus & Navigation (Modal & Notifications, Theme Switcher, Form Validation, Data Binding) toggle their integration from `Tools > KrookedLilly > Focus & Navigation Setup`. Integrations ship disabled by default — your project never picks up code from siblings you do not enable.Full C# source, no DLLs.XML documentation on every public API. Works with both Unity's Legacy Input Manager and the new Input System package (auto-detected at runtime). Zero hard dependencies.Navigation- Spatial directional navigation using angle, distance, and perpendicular-overlap scoring (zero allocation per call)- Four boundary modes: Clamp, Wrap, Trap, Escape- Focus groups with push/pop stack semantics for nested menus and modals- Focus memory — each group remembers its last focused element- Explicit per-element navigation overrides with spatial fallback- Hold-to-repeat navigation with configurable initial delay and repeat rateInput- Auto-detected input adapter: Legacy Input Manager or Input System package- Device auto-detection with distinct Mouse, Keyboard, Gamepad, and Touch values- Submit / Cancel routing with native UI Toolkit event suppression (no double-click, no focus drift)Indicators- IFocusIndicator interface for pluggable focus visualization- USSClassIndicator default implementation using a .focused CSS class- Three visibility modes: Auto (mouse/touch hides, keyboard/gamepad shows), AlwaysShow, AlwaysHideScroll- Automatic scroll-into-view on keyboard/gamepad focus moves inside a ScrollView- Configurable margin, no-op for already-visible elementsEditor- Custom FocusManager inspector with an embedded UIDocument foldout- HideFlags utility prevents Unity's known MissingReferenceException on play-mode exit- Works cleanly across domain reloads and play-mode transitionsIncluded demos- BasicNavDemo — 3×3 grid, the "hello world" of focus navigation- GridNavDemo — irregular 13-button grid with wide cells stressing the spatial algorithm- NestedGroupsDemo — two side-by-side menu panels with symmetric escape-mode boundaries- ModalTrapDemo — reusable confirm dialog with destructive styling toggle per action- ScrollViewDemo — 33-item list with live "Visible: N–M of 33" range readout- DeviceSwitchingDemo — three-mode toggle row demonstrating indicator visibility behaviorCompatibility- Unity 6+ (6000.0 and newer)- UI Toolkit (com.unity.modules.uielements)- Full C# source, no DLLs- XML documentation on all public APIs- Zero external dependenciesAI (Claude Code) was used as a development assistant throughout the package creation process. This includes code generation, architecture design, writing unit tests, documentation authoring, and debugging. All AI-generated code was reviewed, tested, and validated by the developer. The final package is 100% human-supervised C# source code with no AI runtime components.



