I have created a script (below) which when I press play causes the editor to go not responding, so far I have found that the error is in the spawn or delaydecrease function
#pragma strict
var objectToSpawn : GameObject;
var player : GameObject;
var playerZ : float;
var spawning : boolean = true;
var delay : float = 1;
function Start () {
//Spawn();
//DelayDecrease();
}
function Spawn () {
while (spawning)
WaitForSeconds(delay);
var object : GameObject = Instantiate(objectToSpawn, transform.position + Vector3(Random.Range(-85,85),0,0), transform.rotation);
}
function Update () {
player = GameObject.Find("Player");
playerZ = player.transform.position.z;
transform.position.z = playerZ + 150;
}
function DelayDecrease () {
while (spawning)
WaitForSeconds(1);
delay /= 1.1;
delay = Mathf.Clamp(delay, 0.1, 1);
}
Please format your code using the code button (101010), otherwise it's very difficult for us to try to read it.
– Julien-Lyngejust FWIW. i think you have completely forgotten a set of braces at lines 27-28-29
– Fattie