- Home /
UI Button stays highlighted after click
I've made a UI button with its transition state set to "Tint" and I can click it and call a function from its OnClick() event list. It generally seems to work as expected except for one small visual annoyance; after clicking the button, it remains in its highlighted state until I click somewhere else in the scene.
Anyone know why the button will not automatically return to the 'Normal Color' tint after the button is clicked and instead stays stuck on the 'Highlighted Color' state?
Or, does anyone know which class I can use to grab a reference to the button from inside the script being called from the OnClick() event list so I can force the UI button back to its default state?
It seems that this was already answered here, don't know how I missed it when searching previously. The solution there also works for Unity 5.
Answer by koekeritis · Oct 19, 2015 at 08:47 PM
Change the navigation to 'none' on the button component, it's a bug with Unity's keyboard menu navigation.
This works great for the issue described. But if you press the mouse down and drag it out of the button (while still pressed), the button will become highlighted until the mouse is released (and on top of that, if you enter another button while the mouse is still pressed, then release the mouse on top of that other button, the button won't become highlighted, even if the mouse is hovering on top of it). Any idea how to work around this?
@Do$$anonymous$$oOne I'm still seeing this issue a year later. Were you able to find a solution or did you just roll your own button script?
I don't think we actually solved it, we probably just left it alone (it's not something that breaks a game).
Your answer
