I have a GameObject array with a number of different objects. I want - at different times - to instantiate the object stored in GameObject[0], then the one stored in GameObject[1] and so on…
i’ve created this script but it doesn’t work…
var enemies : GameObject[];
function Update () {
if ((Time.time > 0) && (Time.time < 5)){
enemies = enemies[0]; // i think the problem is in this line
GenerateEnemy ();
}
if ((Time.time > 5) && (Time.time < 10)){
enemies = enemies[1];
GenerateEnemy ();
}
}
function GenerateEnemy (){
Instantiate(enemies, Vector3(0,0,0), transform.rotation);
}
Anyone knows where i’m wrong?