Reputation: 560
I have noticed that when I set the interactable property of button to false the button alpha decreases. Does anybody have knowledge on how to achieve this in Unity .
myButton.interactable = false;
It would be immensely helpful if you could help !
Thank you !
Upvotes: 0
Views: 3114
Reputation: 7356
You have to change the "Disabled Color" of the Button component. Check the alpha value.
In order to change it by code :
// Unfortunately, you can't do button.colors.disabledColor.a = 1 ;
UnityEngine.UI.ColorBlock colors = button.colors ;
Color disabledColor = colors.disabledColor ;
disabledColor.a = 1 ;
colors.disabledColor = disabledColor ;
button.colors = colors ;
Upvotes: 7