Skip to main content

Function: createUiNavigationEcsSystem()

createUiNavigationEcsSystem(): EcsSystem<[CanvasEcsComponent]>

Defined in: ui/systems/ui-navigation-system.ts:309

Creates a system that drives gamepad/keyboard focus navigation, the counterpart to pointer hover/click that lets a controller or keyboard reach and invoke the same interactables.

Every interactable: true UiInteractableEcsComponent - not disabled by an ancestor CanvasGroupEcsComponent either, see resolveCanvasGroupState

  • is automatically focus-navigable: on the tick a canvas's navigateInput magnitude first crosses navigationThreshold, focus moves to the nearest candidate on the same canvas in the dominant direction (a UiFocusEcsComponent on the currently focused entity overrides that search on whichever sides it sets). submitInput raises onInvoke on the focused element; cancelInput clears focus - register your own listener on cancelInput.triggerEvent for bespoke "close this menu" behavior.

Also resets every UiInteractableEcsComponent.wasInvokedThisFrame to false at the start of its tick, before re-setting it for this tick's submit invocation - the single point in the pipeline responsible for that reset (see createUiInteractionEcsSystem, which only ever sets it true for the pointer path and relies on this system having already cleared it this tick). Always register this system - even on a canvas with no submitInput/cancelInput/navigateInput configured - or wasInvokedThisFrame never clears; createUiCanvas does this for you.

Must be registered after createUiRaycastEcsSystem (if present) and before createUiInteractionEcsSystem.

Returns​

EcsSystem<[CanvasEcsComponent]>

The UI navigation ECS system.