Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.

Bug Editor becomes unstable after infinite loop crash

Discussion in 'Editor & General Support' started by hawken, May 21, 2021.

  1. hawken

    hawken

    Joined:
    Aug 22, 2013
    Posts:
    826
    Hi, if you lock up the editor with an infinite loop (while etc), restarting the editor, theres a problem with playback where the editor injects 60~80 millisecond pauses when using while loops.

    The only fix is to reboot the computer entirely.

    MAC OSX Big Sur
    Unity 2019 LTS

    Anyone else noticed this?
     
  2. bobisgod234

    bobisgod234

    Joined:
    Nov 15, 2016
    Posts:
    1,042
    What do you mean by the editor "injecting" pauses?

    Have you used the profiler to see what is going on?
     
    hawken likes this.
  3. hawken

    hawken

    Joined:
    Aug 22, 2013
    Posts:
    826
    Sure yes, this how I was able to see the length of the pauses. They are compacted into a long block called "player loop". This only happens after reopening Unity after a crash, if I reboot my pc the long pauses are gone.
     
  4. bobisgod234

    bobisgod234

    Joined:
    Nov 15, 2016
    Posts:
    1,042
    Switch to deep profiling and drill deeper.

    Are you sure it is the while loop itself that is causing pauses? I doubt it. This is a pretty basic C#/Mono construct, not exactly a Unity thing. Try surrounding your suspicious while loop with ProfileMarkers to see if the pause is really happening there. https://docs.unity3d.com/ScriptReference/Unity.Profiling.ProfilerMarker.html
     
    hawken likes this.
  5. hawken

    hawken

    Joined:
    Aug 22, 2013
    Posts:
    826
    Thanks I'll try deep profiling. Looking for a way to submit a cohesive bug report, however it's 2019 LTS and not sure if editor issues will be fixed anyway... Would be interesting to see if this is happening in 2020 LTS