- Home /
UI Buttons Interactable switch
Hi,
I have 2 buttons with color tint transition mode and I set interactable= false on the one I click and set the other one to interactable= true.
Simple switch with button everything is working fine...
But, when the button is intractable again the button don't take the normal color but stay on the Highlight color until I go over it with the mouse...
Why ?
I tried everything to force the normal color but there's just no way. I can't find where the color tint is applied to the button. I even looked in the source of the Unity UI system...
Can someone explain the trick here ? I'm getting quite mad against the Unity UI system for this kind of weird behavior.
Thanks in advance !
Answer by ismaelnascimento01 · Jun 07, 2017 at 06:37 AM
Try it:
void Update() { if(button.GetComponent().interactable == true) { button.GetComponent().color = Color.white; } }
Hi,
Thanks for your reply. Sad story thought your code doesn't exist.
The Button UI class do not simply have the "color" property.
I've tried :
button.targetGraphic.color = btn.colors.normalColor;
But that doesn't work either, because the color change made by the Unity color tint is not applied to the renderer... sadly.
Have you another idea ? or somebody else please ?
Thanks !
Your answer
Follow this Question
Related Questions
Play sound on noninteractable / disabled / grayed out button 1 Answer
Callback when 'interactable' is toggled on a UI button? 0 Answers
UI Button not working 2 Answers
How to detect interactable state change in selectable objects (Buttons, etc.) 3 Answers
Make a button selectable for controller but not interactable 0 Answers