UI Navigation
UI Navigation
Duration: 2 days
Platform: Editor & Android TV
Git: https://github.com/Ruslan1M/UI-Navigation.git
What it is. A lightweight plugin for TV navigation in Unity that makes focus navigation with a remote control predictable: it automatically selects available items, correctly steps through neighbours (including wrap-around), does not clip on overlaps, smoothly scrolls horizontal lists, and works on top of the new Input System. The component attaches to the EventSystem and requires InputSystemUIInputModule.
Why it matters. On TV, standard arrow navigation often breaks down: the focus disappears under overlapping panels, lists do not scroll to the end, and when the focus is lost, the user gets stuck. This tool keeps the focus alive, selects the nearest available button, takes visibility into account, and smoothly scrolls through containers.
How it works. Connected to EventSystem → navigation is handled in one place: input arrows, auto-select when focus is lost, transition to neighbour (explicitly specified or automatically found), fallback to list scrolling, highlighting of selected item.
var current = es.currentSelectedGameObject ? es.currentSelectedGameObject.GetComponent<Selectable>() : null;
_selectableHighlighter.SelectElement(current);
var mv = _moveValue;
if (Mathf.Approximately(mv.x, 0f) && Mathf.Approximately(mv.y, 0f))
{
_consecutiveMoveCount = 0;
return;
}
var moveDir = MoveDirection.None;
if (mv.sqrMagnitude > 0f)
{
if (Mathf.Abs(mv.x) > Mathf.Abs(mv.y))
moveDir = mv.x > 0 ? MoveDirection.Right : MoveDirection.Left;
else
moveDir = mv.y > 0 ? MoveDirection.Up : MoveDirection.Down;
}