I have a bunch of 2D sprites in my game, all Instantiated from prefabs. I want to change the color of the SpriteRenderer according to a float value, but whenever I do so through this code:
gameObject.GetComponent<SpriteRenderer>().color = colours[someInt];
the gameobject isn’t rendered at runtime. If I comment out that line, it renders
colours is an array of type Color, which I have populated
The shown line is inside Update(), and the script is attached to the prefab