I don't understand why setInterval() is an unknown identifier.
I am trying to spawn a prefab every second, but I only get that error.
here is my script:
#pragma strict
public var spawning : GameObject;
public var seconds = 1;
function Start (){
setInterval(spawn(), seconds*1000);
}
function spawn(){
Instantiate(spawning);
}
I also tried to use yield waitforseconds, but then I found my second problem. The prefab didn't spawn even though I selected it as 'spawning'.
If I already had the prefab somewhere in the scene. It spawned. but then what spawned was clones of the clones of the clones etc. after some time running, the game froze/crashed.