This is a script that is supposed to create the floor around the player if there is not a block there already but it freezes up unity
#pragma strict
var X : int;
var Y : int;
var Z : int;
var grassBlock : GameObject;
var hill : GameObject;
function Start()
{
while(1)
{
for(var i=(X-64) ; i<(X+64) ; i++)
{
for(var j=(Z-64) ; j<(Z+64) ; j++)
{
if (!(Physics.Raycast (Vector3(i,0,j+2), Vector3.back, 2 )))
{
Instantiate (grassBlock, Vector3(i,0,j), Quaternion.identity);
}
}
}
yield;
}
}
function Update ()
{
X = transform.position.x;
Z = transform.position.z;
}
– roojerrywhile(1)is an infinite loop. Not escaping that loop is why unity is freezing@brianruggieri - The while(1) loop won't freeze the app because of the 'yield'.
– robertbuAh. Didn't pick that out when the code was unformatted
– roojerry