Hey guys so Im trying to make a Pause Menu in Unity with Buttons that change color when highlighted or pressed. Right click Canvas, UI, Button and in inspector view I change the colors for “Normal Color”, “Highlighted Color” and “Pressed Color”. Normal Color changes instantly but when I press play, the Highlighted and Pressed colors dont seem to work when I hover over the buttons or click them with the mouse.
Ive watched two tutorials on how to make the menu and they just quickly select the color and it works no problem. Any reason why it isnt working for some people? Using version 5.6.0f3
I had the same problem and debugged it somehow lol.
The reason my button is not being highlighted is that I have an image with a transparent background that is covering my button’s ray case. So I go to my image and disable the “Raycast Target” option. Fixed
The same problem occurs with 2018.2. Sucks.
My quick workaround to make the ‘Normal’ color to come back after the button has been released:
In my function that is called when the button is depressed, I disable and then right after I enable ‘Button’ component.
exampleButton.enabled = false;
exampleButton.enabled = true;
Not visible to the viewer and it brings the normal color back. I know it is not the right way but it is quick and easy fix. So far I have not had any issues with this approach.
P.S. I use ‘Event Trigger (Script)’ and ‘PointerUp’ Event Type to call some functions when the button is being released. That is where I have put my reset code.
If the sprite you are using for a button is completely black, none of the colors will show. Just thought I’d add that because it was my problem.
Is there an Event Sytem on your scene, are its scripts active ?
Is your button script active, is its parameter “interactable” active ?
I’m having the same problem - my settings are as listed, too. Did you ever find a resolution?,I’m having the same problem; all of my settings are checked as well - very odd.
It’s an old question, but now I had the same problem. If anyone else has:
Which Input System do you use? Click on EventSystem in your hierarchy and have a look at the inspector. If you are using the new Input System somewhere else, this should be marked there and there sould be an option to directly change.,Its an old question, but now I had the same problem. If anyone else has:
Which Input System do you use? Click on EventSystem in your hierarchy and have a look at the inspector. If you are using the new Input System somewhere else, this should be marked there and there sould be an option to directly change.
For me, it was because my target graphic was set to alpha 0 in the scene. The color tint multiplies the Image’s color, so it has to be 1 in the scene. That’s inconvenient, as I use a mask over the button that is set to alpha 0 when the button is active. So the button has to look inactive in edit mode…
Sorry to bump this again, but I ran into a similar issue myself today and I found it was a different problem for me. I’ll post my solution here in case it helps anyone else dealing with the frustration.
I have my menu stored as a prefab, and any time I have the prefab open while I run my game, the buttons don’t highlight properly. Sometimes the highlight will disappear or work erratically. So, if you’re using a prefab, try closing it when you run the game!
It seems like this may be a Unity bug. I’m using version 2019.3.14f1.
When assigning values from the inspector!
All of the values for ColorBlock and Color default to 0!
- Set Color Multiplier to 1 or greater
- Set each colors alpha to a visible (or preferred) value
Had similar problem.
In my case I had «Target Graphic» field of Button set wrong. After I set it to Image component of Button object, everything worked fine.
For the late comers:
I had this problem and found a different solution: check the EventSystem game object in the scene. I deleted mine and added a new one. Fixed.