It seems like you’re performing the Instantiate function completely outside the Update method. Therefore it only runs it once upon class initialization.
Here’s something that should work with the Update method:
var z : GameObject;
var spawnTime: float = 1;
private var lastSpawn : float = 0;
function Update () {
lastSpawn += Time.deltaTime;
if (lastSpawn > spawnTime) {
lastSpawn = 0;
Instantiate (z);
}
}
var z : GameObject;
var spawnTime: float = 1;
function Start(){
SpawnZombies();
}
function SpawnZombies(){
while (true) {
Instantiate (z);
yield WaitForSeconds(1);
}
}