I’m trying to create a simple runner and have the game spawn a new enemy every 3 seconds, but when I use yield within a function instead of spawning a new enemy every 3 seconds, after 3 seconds the game doesn’t stop spawning enemies. I’m betting it’s something simpel but I’m not seeing it.
public var Spawn : GameObject;
function Update () {
CreateEnemy();
}
function CreateEnemy () {
var enemyInstance: GameObject;
yield WaitForSeconds(3.0);
enemyInstance = Instantiate(Spawn,transform.position,transform.rotation);
}