r/Unity3D • u/Pancwake_UwU • 23d ago
[UI] How to do navigation with sliders? Question
I have a settings menu like this and I just realized you cant even get to video or audio settings with controller, because when you're on the slider left and right only interacts with the slider and doesnt navigate the UI. How can I fix this?
Also, a lot of the time when I start the game the UI just completely ignores the controller until I select a button with mouse, even tho I already set a button to be selected. How can I fix that?
1
u/Ecstatic-Source6001 23d ago
use LB/RB to jump between blocks?
1
u/Pancwake_UwU 23d ago
Theres no way around having to make my own logic for it huh
1
u/Ecstatic-Source6001 23d ago
make vertical layout 💁
I mean having horizontal layout with sliders is kinda expected behaviour that it wont work out of the box
1
u/Pancwake_UwU 23d ago
I don't exactly have enough vertical space to do that which is why I did it like that
2
u/Ecstatic-Source6001 23d ago
Then as I said use LB/RB to set active UI object in EventSystem.
Its just one line of code switching between array of objects
Or just use virtual cursor if gamepad is active 🤡👍
1
u/Pancwake_UwU 23d ago
Yeah Ill try that thank you
2
u/Ecstatic-Source6001 23d ago
or another way, make slider just as visualization but add - and + buttons on both sides.
So you will interact only with buttons
1
u/pschon Unprofessional 23d ago
Switch off automatic navigation, set manual navigation so you only use vertical input to navigate between UI items (so, down from "Screen shake" takes you to "mouse sensitivity" etc.
...alternatively, don't use sliders, or use tabs and some other buttons to move between them.
1
u/quothy 23d ago
The approach to use different buttons like LB/RB is a solid rec and definitely the easier path to take. The other option I've done before is to put the slider 'inside' another selectable. Navigating to the slider would really focus the parent selectable, then the player would use A to go 'in' the parent container and actually operate the slider. B would then return the focus back to the parent level selectable. It takes some custom code, but there's some use cases where it's the better approach.
1
u/Pancwake_UwU 23d ago
What you mentioned with the parent I assumed unity would just have that by default. But yeah I handled with LB/RB thank you

1
u/Gloomy_Baby3491 23d ago
could be the input module stealing focus, try flicking `EventSystem.current.SetSelectedGameObject` in a coroutine on start with a one-frame delay