Hello,
When I play my project, it runs for like a second, then freezes. Spent three evenings trying to figure out why, without progress. I realize I need some help.
Besides the default Main Camera and Directional Light, the scene contains only one game object.

This object contains two C# scripts:

Both are classes which inherits MonoBehavior and contains update functions.
The World class Update() function which looks as following:
void Update()
{
counter += 1;
Debug.Log("World Update " + counter.ToString()) ;
byte ix = (byte)Random.Range(0f, Region.width - 1);
byte iy = (byte)Random.Range(0f, Region.height - 1);
byte iz = (byte)Random.Range(0f, Region.width - 1);
regions[0, 0].SetVoxel(ix, iy, iz, 0);
CheckCurrentY();
UpdateRegions();
Debug.Log("World Update " + counter.ToString() + " Done!");
}
}
The scene plays fine without the line:
regions[0, 0].SetVoxel(ix, iy, iz, 0);
So you’d think I’d easily find the problem by stepping into the SetVoxel() function. Well, I tried that, but the freeze happens only after some unpredictable number of updates, so it’s difficult to enter it in the right moment. Moreover, by placing Debug.Log() messages on strategic places in my code I noted that the freeze doesn’t happen while executing that line. Instead, the last message shown is from the update function of the other class: Input Controller.

And that update function is essentially empty:
void Update()
{
Debug.Log("InputController Update");
Debug.Log("InputController Done.");
}
So, the freeze doesn’t happens while executing either update function. Rather the editor freezes between them.
Does anyone have a clue what could be wrong, or suggestions how to proceed?
EDIT: Also, no, my code does not contain any while-loops.
Also: I’m kinda new to C# and Unity. My apologies if this is daft.
