Buttons Selected Color is not active when said button is set as selected via SetSelectedGameObject
Hello!
So in my game i'm setting the default selected button in my menus via the "SetSelectedGameObject" call. Now, it does as it says and sets the gameobject as selected. So when I begin to move my controller stick/dpad it navigates correctly. However, when I call this the button doesn't change to it's "Selected" color that I've defined in the inspector. Of course, I'm able to say, move down to the next option, than back up to that same button and THEN the color changes. But it's just annoying having the user see no default selected button when they bring up the menu.
Other than changing the color of the object manually, by changing the color to it's selected color. Anyone got any other better ideas? Surely something better than that...That sounds so cumbersome.
Thanks!
UPDATE
For this project we ended up having to write a custom script using the I$$anonymous$$oveHandler, ISelectHandler, and ISubmitHandler interfaces. A hacky way that we define the default selected game objects for each menu in the inspector.
Basically, there's a check on every move and select to see if they match and then we manipulate the colors.
Very, very frustrating but it works..
Answer by arzi · Jul 09, 2016 at 09:23 PM
I have the same problem, in addition to this, any inheriting OnSelect is not called either.
For me it works fine if the button is in the scene, but breaks if the button was instantiated runtime.
For this project we ended up having to write a custom script using the I$$anonymous$$oveHandler, ISelectHandler, and ISubmitHandler interfaces. A hacky way that we define the default selected game objects for each menu in the inspector.
Basically, there's a check on every move and select to see if they match and then we manipulate the colors.
Very, very frustrating but it works..
Your answer
![](https://koobas.hobune.stream/wayback/20220612064806im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Navigating with controller doesn't stops if there is a UI Toggle. 0 Answers
Disabling part of an event system? 1 Answer
Unity automatic UI navigation events get messed up after entering playmode 0 Answers
If I disable/enable my canvas (pause game menu), controller navigation in the canvas stops to work? 1 Answer
Help needed with menu navigation. 0 Answers