Hi
How would I set the color property of an instance before I instantiate it?
At the moment, since the same material is shared between all instances, when I click on my color changer GUI, all the instances change to the set color. I want the instances that are already created to remain the same, while the next instantiation(s) to have the color I set through the GUI.
My current color changer script is just a selection grid with color swatches instead of labels.
var randomObject : GameObject;
var selectionGridInt : int = 0;
var icons : Texture[];
function OnGUI () {
selectionGridInt = GUI.SelectionGrid (Rect (Screen.width - 40, Screen.height / 2 - 230, 30, 230), selectionGridInt, icons, 1);
switch(selectionGridInt){
case 0:
randomObject.renderer.material.color = Color.black;
break;
case 1:
randomObject.renderer.material.color = Color.red;
break;
case 2:
randomObject.renderer.material.color = Color.yellow;
break;
case 3:
randomObject.renderer.material.color = Color.green;
break;
case 4:
randomObject.renderer.material.color = Color.blue;
break;
case 5:
randomObject.renderer.material.color = Color.cyan;
break;
case 6:
randomObject.renderer.material.color = Color.magenta;
break;
}
}