Quantcast
Channel: Questions in topic: "javascipt"
Viewing all articles
Browse latest Browse all 1875

BCE0005: unknown identifier: 'setInterval' + prefab wont instantiate

$
0
0
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.


Viewing all articles
Browse latest Browse all 1875

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>