Endless loop within an arms reach

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.

3 Likes

Experience is what we get when we don’t get what we want :grinning:

Hey! I have this same Issue you know how can I Fixed?

Hey, just check your inner and outer loop syntax.
In my case the inner loop should had had “Z” in each part, while I had one “X” there.

You have an endless loop? Check the conditions of your loop, make sure you’re not making the mistake in the first post where you are mixing iterators in the inner loop which makes sure the loop never completes.

1 Like

Privacy & Terms