I’m sure there’s a simple solution for this, but I’m a total noob to code.
I’m trying to assign sprites with a random color from an array.
private Color[] colors = new Color[6];
void Start(){
colors[0] = new Color(87f, 156f, 236f);
colors[1] = new Color(246f, 108f, 108f);
colors[2] = new Color(87f, 113f, 236f);
colors[3] = new Color(240f, 78f, 74f);
colors[4] = new Color(87f, 212f, 236f);
colors[5] = new Color(131f, 112f, 208f);
SpriteRenderer temp = GetComponent<SpriteRenderer>();
if( temp == null )
Debug.Log("fuck");
temp.color = colors[Random.Range(0, colors.Length)];
}
(It also doesn’t work if I take out the conditional statement)
Appreciate all help as always
Thanks