i am trying to spawn prefabs at random time intervals and for some reason the script makes my unity hang
so my question is…
how to replace 5 in yeild WaitForSeconds(5) with a variable in the following script?
var pickup : Transform;
var d = Random.Range(5,20);
private var curObject: Transform;
function Start ()
{
while (true)
{
var y = Random.Range(-4,6);
var prefab;
prefab = pickup;
curObject = Instantiate(prefab, Vector3(20,y,0), Quaternion.identity);
}
yield WaitForSeconds(d);
}
thank you.