Search Unity

  1. Unity 6 Preview is now available. To find out what's new, have a look at our Unity 6 Preview blog post.
    Dismiss Notice
  2. Unity is excited to announce that we will be collaborating with TheXPlace for a summer game jam from June 13 - June 19. Learn more.
    Dismiss Notice

Bug Editor becomes unstable after infinite loop crash

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

  1. enhawk

    enhawk

    Joined:
    Aug 22, 2013
    Posts:
    833
    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?
     
    enhawk likes this.
  3. enhawk

    enhawk

    Joined:
    Aug 22, 2013
    Posts:
    833
    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
     
    enhawk likes this.
  5. enhawk

    enhawk

    Joined:
    Aug 22, 2013
    Posts:
    833
    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