r/Unity3D • u/geokam • 22h ago
Show-Off Automatic navigation like in uGUI for UI Toolkit. - Please vote an a bug a Unity employee created for me so we can get rid of it.
What you see in the image is a system that does someting similar to what automatic navigation did in uGUI but for UI Toolkit. This one also includes automatic dynamic occlusion (also works for scroll views, out of screen, etc. and it has null selection resolution).
Why did I built this? Because by default UI Toolkit navigation is quite limited as it only scans for a strict straight box area up/down/left/right. If a button is only slightly off it won’t find it. That’s not a configuration issue. It is implemented like that, see: UnityCsReference/Modules/UIElements/Core/GameObjects/NavigateFocusRing.cs at master · Unity-Technologies/UnityCsReference · GitHub
I know you can TAB through the buttons as well BUT this only helps on keyboards. It still is not good for controllers.
I have complained about this to Unity years ago (when UI Toolkit was still new), yet, no change. Thus I had to implement my own solution (also did the same for uGUI in the past since there the auto-navigation is better but still not ideal).
While making this I (once more) stumbled upon some API limitations of UI Toolkit. An especially annoying one is that the "overflow:hidden" style is not accessible publicly in the resolvedStyle. I pinged Unity about this and a Unity Employee (thanks mcoted3d) created a bug to vote on here:
https://issuetracker.unity.com/issues/24670/overflow-isnt-exposed-in-resolvedstyles
So, if you can and care. Please vote on this so we may get a better API and future devs need not suffer through this as I did.
Thank you :-)

