So i have a boolean array with 100 values and 100 buttons , and i want a button to have a color if its respective value in the array it's true and another one if it's false. i tried this :
public Button buton;
public Image imagine;
public int lvl;
void Start()
{
buton = this.GetComponent<Button>();
imagine = this.GetComponent<Image>();
}
void Awake()
{
if(Storage.lvls[lvl] == true || lvl == 0)
{
buton.interactable = true;
imagine.color = new Color(255, 134, 32, 1);
}
else
{
buton.interactable = false;
imagine.color = new Color(2, 0, 46, 170/255);
}
}
i wrote this
because i wanted to add it as a component to the specific button.
i am getting this error NullReferenceException: Object reference not set to an instance of an object butoane.Awake () (at Assets/Scripts/butoane.cs:26)