I’m trying to make a button change color depending on an array. If hand[0]==‘f’, color==red. And so on for the other 13 cases. I’m trying to get a script that checks if anything other than ‘_’ is in the spot, and if so, color=changed. How can I do that? There is no UI.button.image.color setting.
hi,
I guess you are missing a library which is required to access new UI elements.
using UnityEngine.UI;
I hope it helps.
You can do this, it will change the colors of a button. This will give the button a half transparent red background.
ColorBlock colorblock = ColorBlock.defaultColorBlock;
colorblock.normalColor = new Color(1, 0, 0, 0.5f);
somegameobject.GetComponent<Button>().colors = colorblock;
public UnityEngine.UI.Button ButtonProxCena;
ButtonProxCena.GetComponent<UnityEngine.UI.Image>().color = Color.black;