Hi! I’m working on a game where my gun changes colour depending on the amount of kills I have. The problem is my gun is made out of 100 gameobjects. I can’t change the colours of the objects unless I do it individually:
var changeColourBlock : GameObject;
var redMaterial : Material;
var gunKills : int;
if (gunKills >= 275)
changeColourBlock.renderer.material = redMaterial
How can I change the colour of multiple gameobjects in code without having 100 different gameobject variables and 100 lines of code on top of this?
P.S I have tried using:
var changeColourBlocks : GameObject[];
But this doesn’t work.
Any help would be appreciated, thanks!