PSA: if you made a typo and do like this:
for (int x = 0; x < LevelGrid.Instance.GetWidth(); x++)
{
for (int z = 0; x < LevelGrid.Instance.GetHeight(); z++)
You will end up seeing Unity process eating all the memory and manually ending the task would be the only option.
The inner for loop should not have “x” referencing the outer for loop, especially in the loop expression section.