- Home /
How to determine which part of the game is crashing Unity Editor
HI all,
When i play my game in the Unity Editor, it runs for about 15s and then Unity freezes. I tried the profiles but i don't know what to look for. Even if i manually disable parts of the code and find out which part of the code is causing it, how do i troubleshoot/debug the problem? I am quite inexperienced and new to Unity5
I really appreciate any help you can provide me. Thanks.
Answer by nathanvj · Feb 08, 2018 at 10:37 PM
Unity Editor crashes are often caused by infinite loops. Check all loops in your code one by one, especially the while loops. Make sure you don't have any infinite recursive function. What script function (that contains a loop) could be called at the 15th second?
Yes, you are correct. When i took a closer look at the code i found that in a loop i was transferring a object from one place to another (changing parents) and in once case there were no more object to transfer and the condition was always true after that so a endless loop with a recursion started to happen.
Well, heck... I've been fighting a crash all day. I've wanted to test the number of entities I can instantiate in batches, so why not go batch by batch, watching the Entity Debugger until I see the stopping point? I could gave 8 million on screen two days ago, and this is much more optimized, and... oh. 3100.
Guess this explains it.
Your answer
Follow this Question
Related Questions
What is the recommend way to debug an Editor crash? 1 Answer
Is there a way to check the performance in edit-mode? 1 Answer
Unity editor crashes 90% times I try to build project for iOS or Android 0 Answers
Unity crashes after I open it 0 Answers
Android Development Build Crashing After Splashscreen 2 Answers