Debugging infinite loops

Does anyone know a good way to debug infinite loops?

Unity is kind enough to crash, making it difficult, if not impossible to track them from MonoDevelop’s debugger. So, I get to play “hunt the loop” with debug statements in code… it’s a real pain

You can set break points inside of MonoDevelop and attach the process to the Unity Editor then run the code. Once the code hits that break point it will stop. You can then step through it. If it works that loop is not the issue. Unity will still crash, but at least this way you can go loop by loop without having to rely on Debug.Log statements. And once Unity crashes you know you have found your culprit.

If you attach your mono develop to unity3d when is crashed due to a infinite loop, you can pause execution to see the loop where executio is stuck. If you resume and pause several times, you can guess where is the problem :wink:

Vote here for Unity to fix this. There is no other way.