I want to change the opacity of my buttons disabled color with code in this exact loop so I was wondering how? Maybe sommething like how I disabled interactability. It should be done to tictactoeSpaces too.
for(int i = 0; i < tictactoeSpaces.Length; i++)
{
tictactoeSpaces[i].interactable = false;
}
Does it need to be via code?
You actually can configure that in the Inspector of the Button component
If you really need to do it on runtime you can change it via the Button.colors property like e.g.
var button = tictactoeSpaces[i];
var colors = button.colors;
var disabledColor = colors.disabledColor;
disabledColor.a = /*NEWALPHA e.g.*/ 0.2f;
colors.disabledColor = disabledColor;
button.colors = colors;
button.interactable = false;