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

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.

Firstly, your function spawn(), is not being referenced in start, at least with what i am used to. Also your Instantiate needs a few more things, and the variables are public statics which are used for referencing in other scripts, so i changed them to normal variables. Here is the script that should work, reply if it isn’t, and the error it gives, and ill try and fix it.

var spawning : GameObject; // Your object to spawn
var exampleposition : Transform; // The location where the GameObject will be spawned, assign in inspector

function Start ()
{
    spawn(); // Referencing the function Spawn()
}

function spawn()
{
    while (true) // This will happen forever, may assign a Boolean to it if you want to switch it on and off
    {
        yield WaitForSeconds (1) // Wait every 1 second
        Instantiate (spawning, exampleposition.position); // Spawn your object at the exampleposition's position
    }
}