i added this script to move all the blocks i my editor to another location, but unity now gives me the beachball of death like it its stcuk in a loop. what happened?
function Update () {
var septoggle = Input.GetAxis("separate");
if (septoggle != 1) {
for (var voxel : GameObject in voxelArray){ //iterates through objects in voxelArray
var voxelLoc = voxel.GetComponent(voxelScript);//gets voxel origin location
voxel.transform.position = Vector3(voxelLoc.x, voxelLoc.y * sep * septoggle, voxelLoc.z);
}
}
}
How many items are in voxelArray?
– Eric5h5There aren't any typeless variables in that code. It probably already has #pragma strict, or if not, it won't make any difference here.
– Eric5h5turns out this code wasn't the problem, i removed #Pragma strict and the block above (generating voxel array) stopped running. i had to remove it because of the multiplication you see there. it thought one of those was an object preventing me to multiply it. ill try converting it to a value Voxelscript is the script kept on the voxels themselves to store variables and such. is there a better way to do this?
– cineboxandrewDo not remove #pragma strict. Write code that works properly with it.
– Eric5h5