- Home /
UI button highlight color not working as it should?
Hi. Not sure if this question is already asked but didn't find it.
My problem is when I'm using the UI elements on my menu screen. So instead of buttons sprites I'm using the color change.
But for some reason the hover doesn't work directly when I run the game. I first need to click somewhere on the screen and then the hover color starts to work.
Is there anyway to fix this without writing a script or using sprites for the buttons? Was thinking about some kind screen focus stuff or so but don't really know what to do. Been using unity only for few weeks so that might also be the problem here :D
/Jere
Answer by Kiwasi · Nov 25, 2014 at 06:01 PM
This is normal when hitting the play button in the editor. You need to give the game window focus before it will take input.
This is not normal behaviour for a build. However I suggest you do a quick build and check, just to make sure there is no underlying problems.
Just tested to build. It still requires me to click somewhere before the buttons change color on hover. I also noticed that the camera is a bit wider in build than what it is in editor. I think that maybe by setting focus to the canvas on start could help this. I just don't know the syntax to set the focus and haven't found anything yet.
Your answer

Follow this Question
Related Questions
How to change text color on hover in new GUI? 10 Answers
Sprite and material not working on buttons 0 Answers
Menu button select outline. 1 Answer
Change the Colour of UGUI button in script? 2 Answers
how to insert hover effect on unity button and active color button when the button is being click ? 0 Answers