I’m getting an “Expressions in statements must only be executed for their side-effects.” compile error.
I’m a bit confused as to why these For statements are triggering this error. This loop is supposed to basically generate a slightly non-uniform grid of objects from a prefab.
private var generate : int = 1;
var prefab : Transform;
function Start ()
{
}
function Update ()
{
if(generate == 1)
{
for(var x=-1.5; x<35; x+0.5)
{
for(var z=-2; z<63; z+0.5)
{
var spreadEffect : int = Random.Range(1, 3);
if(spreadEffect==1)
{
Instantiate (prefab, Vector3(x, 12, z), Quaternion.identity);
}
}
}
generate = 0;
}
}