The new 4.6 buttons have options for Highlighted color, Normal color, Pressed color, Disabled color. I want to change those with code.
When I try something like
tempButton.GetComponent<Button>().colors.normalColor = Color.red;
I get an error: Assets/2-scripts/LevelSelectMenuScript.cs(32,49): error CS1612: Cannot modify a value type return value of `UnityEngine.UI.Selectable.colors’. Consider storing the value in a temporary variable
When I try something like
tempButton.GetComponent<Button>().image.color = Color.red;
I get a weird mix of the image color (from the image component) and the normal color (from the button component)
Any ideas on how to do it right?