Troubleshooting and FAQ
Focus doesn’t go where I expect
Section titled “Focus doesn’t go where I expect”Press F9 in Play mode (editor or development build) to show the debug overlay. It marks every focusable element green or red, shows the reason for each red one, and after a move it shows the score of every candidate. For a closer look, open Window > UI Toolkit > UIFlow Debugger and type the element’s name in Why not?.
The usual reasons:
| Reason | What it means | What to do |
|---|---|---|
OutsideCone |
The element is ahead but too far to the side. | Add a link, or raise coneHalfAngle. |
NotInDirection |
The element’s centre isn’t past the focused element’s centre. | Add a link. |
Covered |
Another element is drawn on top of it, often a transparent full-screen container. | Set picking-mode: ignore on the container that covers it, or hide it. |
Clipped |
An ancestor with overflow: hidden cuts it off, or it is off the panel. |
Put it in a ScrollView if it should be reachable. |
Transitioning |
Its container is animating, or has the uiflow-transitioning class. |
Wait for the transition to end. Focus becomes available when it does. |
OutsideScope |
It’s in another scope, and the current scope traps focus or stops at that edge. | Check the scope’s trap-focus and edge settings. |
NegativeTabIndex |
tabindex is below 0. |
Use 0 or more, or turn off skipNegativeTabIndex. |
ZeroSize |
The element has no size yet. | Check its layout. |
When the search picks a plausible element that isn’t the one you want, a link is the fix. Don’t fight the scoring weights for one case.
The arrow keys don’t leave a TextField
Section titled “The arrow keys don’t leave a TextField”While a TextField is being edited, Unity’s text editor uses the keyboard’s arrow keys to move the caret and stops the move event, so nothing else sees it. That’s Unity’s behaviour, not UIFlow’s, and it’s what players expect from a text field. Gamepad moves are not affected: the d-pad leaves the field.
Keyboard players leave a text field with Tab or Esc. Links don’t change this, because the move event never reaches UIFlow while the field is being edited.
The focus ring stays after a mouse click
Section titled “The focus ring stays after a mouse click”Unity’s default theme draws :focus styles whatever the device. Scope them to the uiflow-navigating class, which
UIFlow sets on the panel root only while the player uses a gamepad or keyboard:
.uiflow-navigating .menu-button:focus { border-color: #ffd34d; }Two elements look highlighted with a gamepad
Section titled “Two elements look highlighted with a gamepad”The mouse cursor is still resting over a button, so :hover stays on. Scope hover styles to
uiflow-device-pointer, or turn on hideCursorWhileNavigating on the UIFlowDocument:
.uiflow-device-pointer .menu-button:hover { background-color: #3a4a5a; }The first d-pad press after using the mouse doesn’t move
Section titled “The first d-pad press after using the mouse doesn’t move”That’s on purpose. When nothing is focused and the player switches to a gamepad or keyboard, the first press brings
focus back, so the player sees where they are before anything moves or gets pressed. Turn off
restoreFocusOnDeviceSwitch in the settings to change it.
Clicking empty space clears focus
Section titled “Clicking empty space clears focus”That’s Unity’s behaviour, and UIFlow keeps it for mouse users. The next d-pad or arrow press puts focus back where it was.
Focus no longer wraps from the bottom of the screen to the top
Section titled “Focus no longer wraps from the bottom of the screen to the top”Unity’s default navigation wraps around the whole panel when it finds nothing. UIFlow blocks that, because it rarely
lands somewhere sensible. To wrap a menu, set vertical-edge="Wrap" (or horizontal-edge) on a NavigationScope
around it. To get Unity’s fallback back, turn off blockDefaultNavigation.
Elements behind my modal can still take focus
Section titled “Elements behind my modal can still take focus”Put the modal in a NavigationScope with trap-focus="true". Elements fully covered by the modal are already
skipped, but a modal that doesn’t cover the whole screen needs the trap.
A screen that slides in takes focus too early, or can’t take it
Section titled “A screen that slides in takes focus too early, or can’t take it”Elements inside a container running a USS transition on translate, scale, rotate, opacity, position or size can’t
take focus until the transition ends. With focus-on-show, focus moves in as soon as the scope is shown. For
animations UIFlow can’t see (code-driven tweens), call element.SetNavigationTransitioning(true) while it runs.
The right stick doesn’t scroll
Section titled “The right stick doesn’t scroll”It scrolls the ScrollView around the focused element, so something inside the view must have focus. For a
ScrollView with nothing focusable in it (credits, long text), call scrollView.MakeScrollNavigable(). Check
rightStickScrollSpeed on the UIFlowDocument too: 0 turns it off.
A link logs a warning
Section titled “A link logs a warning”[UIFlow] Navigation link ... points to ... means the query didn’t match any element under the navigator’s root or in the panel. Check the name (Play and #Play
both mean the element named Play) or the class (.primary). The warning is logged once per element and direction.
My custom control is skipped, or focus goes inside it
Section titled “My custom control is skipped, or focus goes inside it”UIFlow treats elements the way Unity’s focus ring does. A control that should be one target must be focusable
with delegatesFocus = false. For a container whose children should take focus, either leave it not focusable or
set delegatesFocus = true: the search then looks inside it.
Does it allocate?
Section titled “Does it allocate?”A normal move doesn’t allocate once the screen has been used for a moment. The test suite checks this for the search, links, scopes, collections and the hidden debug overlay, and a performance test drives hundreds of moves across a busy screen and fails on any allocation. The overlay itself allocates while it is shown.
One exception isn’t UIFlow’s: Unity’s ListView, MultiColumnListView and TreeView allocate a little in their
own move handler when they change the selection, with or without UIFlow.
Can I use it with the old Input Manager?
Section titled “Can I use it with the old Input Manager?”UIFlow needs the Input System package. Active Input Handling can be Input System Package or Both.
Several UIDocuments, or several navigators in one panel
Section titled “Several UIDocuments, or several navigators in one panel”Each UIFlowDocument attaches its own navigator, and you can attach navigators to any elements with
UIFlowNavigator.Attach. The search stays inside a navigator’s root. A link can point anywhere in the panel.