Crash on play befor the game even starts.

Im making a randomly generated game that has a number of pieces and then place there own pieces, that place there own pieces… and so on till it reaches a limited number of pieces. When I press the play button unity crashes. the screen gets dim, and the play button turns grey (indicating that it is trying to start, usually thers is a little lag), but it never continues to change to the blue color (indicating that the game is now running). Here is my code.`var left : GameObject;
var right : GameObject;
var canspawn = true;

function Start () {
print(“started”);
if(canspawn){
spawn();
}
}
function Update () {

}

function spawn(){
if(canspawn){
var thing : GameObject;
var pice = Random.Range (1, 4);
print (pice);

	if(pice ==1){
	thing = forward;
	}
	if(pice == 2){
	thing = left;
	}
	if(pice == 3){
	thing = right;
	}
var nextpiece = Instantiate (thing, transform.position, transform.rotation);
nextpiece.BroadcastMessage ("cantnorth");

}
}

function cantnorth(){
canspawn = true;
spawn();
}

function cantsouth(){
//canspawn = true;
//spawn();
}

function canteast(){
canspawn = true;
spawn();
}

function cantwest(){
canspawn = true;
spawn();
}
`

I know from testing that where everything breaks is in the Spawn() function. When i comment it out, that whole thing runs fine. If anyone see’s anything i did wrong, or anything I could do better, please tell me. Also if you have any knowlege of why crashes even happen in unity, I would love the help. Thanks a lot!

As in the comments, you are spawning an infinite amount of objects, this means that you will always run out of memory eventually which is why it is hanging.
Currently there is no time that can spawn will ever be false (and you are never calling any function apart from cant north either)

Even if you add the delay as suggested, it will eventually still crash because you will keep spawning new objects forever (ie. until you run out of memory which will kill it!)