Everywhere online says it is possible to change the 'normalColor' variable of a button in Unity. It is changeable in the inspector, but for whatever reason, when I run the following code:
public class ButtonSelector : MonoBehaviour
{
public string selectedList;
Transform[] t;
void Start()
{
t = GetComponentsInChildren<Transform>();
}
void Update()
{
t[PlayerPrefs.GetInt(selectedList)].GetComponent<Button>().colors = new Color32(191, 255, 203, 255);
}
}
It throws this error:
'Button' does not contain a definition for 'colors' and no accessible extension method 'colors' accepting a first argument of type 'Button' could be found (are you missing a using directive or an assembly reference?).
I am using Unity2021.3.5f1, I don't want to change the Image colour, I specifically want to change the normalColor variable of the button.
I have tried .colors
, .color
, .spriteState
, all of which are not found inside the button class.