Anyone got any ideas for debugging both Unity Editor and Profiler crashing?
Version: 2020.3.16f1.844 Personal
Symptoms:
Both the Editor & Profiler (running in it’s own process) crash, seemingly randomly, when running “explosion” code. The “explosion” code consists of more than 1500 lines of code (I’ve triple-checked to ensure there’s no infinite recursion, confirming with debug output & putting fail-safe logic in all loops). Sometimes the “explosion” code/functionality works great, no issues, sometimes it freezes the editor (forever, without crashing) and sometimes it freezes the editor then crashes after 15 to 45 seconds. I cannot reliably reproduce any of the symptoms. When the profiler doesn’t also crash, I sometimes see physics taking 400+ms per frame for a few seconds, but the call stack doesn’t always include my game code, just Unity calls.
Things I’ve Tried:
Using the Profiler, in both attached and detached (separate process) modes. However, when the Editor crashes quickly so does the profiler (in either mode), which seems bizarre and to suggest a core Unity engine bug (dunno, just guessing).
Slowing down the timeScale (and even setting to 0) in an attempt to catch watch happens right before the crash - didn’t help
Refactoring (many times the “explosion” code. If I increase the number of StartCoroutine calls (which are used to time explosions and scale the mesh cutting across multiple frames) by using WaitForEndOfFrame instead of WaitForSeconds, then the crashing happens more frequent and quicker (I have fail safe/counter code in the coroutines to ensure recursion doesn’t happen for than 60 times)
Ensuring that I’m not mistakenly/unwantingly setting the timeScale to 0
Checking the logs - I haven’t found anything so far, but I may be missing a dmp file that Unity provides but I can’t find.
Any suggestions greatly appreciated.