Focus and Controller Navigation
LUI uses UI Toolkit focus and navigation events.
Focusable by default:
ButtonInputToggleSlider- any element with
.OnClick(...)
Use .Focusable(false) to opt out.
Lui.Button("Decorative", "...", OnClick).Focusable(false)Use .TabIndex(...) to set order:
Lui.Button("First", "...", OnFirst).TabIndex(1)
Lui.Button("Second", "...", OnSecond).TabIndex(2)Submit activation works for:
- buttons and native controls through UI Toolkit
- clickable divs/images through LUI’s
NavigationSubmitEventbridge
Focusable elements show a themeable focus ring. Customize with ring-* classes or use
focus: variants:
Lui.Button("Delete", "bg-slate-800 ring-danger ring-4", Delete)
Lui.Button("Selected", "bg-slate-800 focus:bg-primary focus:scale-105 transition", Select)Focus in Scroll Views
When an element receives focus, the renderer asks ancestor ScrollViews to scroll that
element into view. This makes keyboard/gamepad navigation usable in long lists.
Scene Setup for Focus
Navigation input comes from the scene EventSystem, not from LuiDocumentHost.
Make sure:
- there is an EventSystem in the scene
- Unity Input System UI actions are available
- Active Input Handling includes the Input System if the project uses it
Last updated on