Arrow-key / gamepad focus traversal between focusable elements in a panel — Unity's built-in focus ring. Luna's role is to keep it usable when multiple views are layered: by auto-disabling the interactable elements of views underneath the active one, the focus ring can't wander off into hidden UI.

Not to be confused with Navigation, Luna's screen push/pop stack. Focus Navigation = arrow keys moving the highlight between buttons within a view. Navigation = pushing a new view onto the stack.

See the Disable Other Views On FadeIn field in UIView or UIViewComponent.

What Luna adds over the raw focus ring

Out of the box, UITK's focus ring has no concept of layered views: a screen sitting behind your modal keeps all of its elements focusable, so arrow keys or a gamepad can walk the highlight onto buttons the player can't see or shouldn't press. When a view with Disable Other Views On FadeIn fades in, Luna's input blocking closes that gap:

  • Every focusable element registered by other views gets pickingMode = Ignore + focusable = false — removed from both pointer picking and the focus ring in one move, so neither mouse clicks nor controller traversal can reach behind the active view.
  • Visual styling is untouched. Unlike SetEnabled(false), no :disabled USS rules fire — nothing behind the modal greys out mid-fade.
  • Each element's original pickingMode is snapshotted at block time and restored exactly when the view fades out. Already-blocked elements are not re-snapshotted, so stacked modals unwind correctly: closing the inner modal returns focus to the outer modal, not to the screen underneath both.

Auto Navigation

Each UI Toolkit panel features a focus ring that determines the focus order of elements. You can learn more about this feature here:

Unity: Dispatch Events (opens in new tab)

Change what element is focused next

You can manually determine what element is focused next.

csharp
myVisualElement.RegisterCallback<NavigationMoveEvent>(e => { switch(e.direction) { case NavigationMoveEvent.Direction.Up: U.Focus(); break; case NavigationMoveEvent.Direction.Down: D.Focus(); break; case NavigationMoveEvent.Direction.Left: L.Focus(); break; case NavigationMoveEvent.Direction.Right: R.Focus(); break; } e.StopPropagation(); // Prevent further processing of the event myVisualElement.focusController.IgnoreEvent(e); // Prevent default navigation });

Settings

Theme

Light

Contrast

Material

Dark

Dim

Material Dark

System

Sidebar(Light & Contrast only)

Light
Dark

Font Family

DM Sans

Wix

Inclusive Sans

AR One Sans

Direction

LTR
RTL