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.
  2. Have a look at our Games Focus blog post series which will show what Unity is doing for all game developers – now, next year, and in the future.
    Dismiss Notice

Bug Editing code while in run mode causes Unity 2021 to hang / crash

Discussion in 'Editor & General Support' started by hawken, Sep 29, 2022.

  1. hawken

    hawken

    Joined:
    Aug 22, 2013
    Posts:
    759
    If I edit code while Unity 2021 is running, then switch back to Unity, it will crash or hang.

    In Unity 2019, 2020 there was a failsafe here where it would exit play mode when switching back.
     
  2. CodeSmile

    CodeSmile

    Joined:
    Apr 10, 2014
    Posts:
    1,564
    upload_2022-9-29_17-42-18.png

    You probably didn't mean to say "crash" as that implies the editor crashing. Most likely the assembly reload will cause scripts to throw exceptions due to losing references, thus preventing playmode from working until restarted.
     
    hawken and spiney199 like this.
  3. hawken

    hawken

    Joined:
    Aug 22, 2013
    Posts:
    759
    I'll try recompile and continue, thanks.

    Currently "stop playing and recompile" causes Unity to hang indefinitely.
     
  4. CodeSmile

    CodeSmile

    Joined:
    Apr 10, 2014
    Posts:
    1,564
    This only happens while in Playmode?

    An infinite compilation loop is something that can happen if you generate or modify scripts (or assets like folder names) when an assembly reload occurs and there's a bug that causes changes to the generated/modified assets to change every time, thus triggering another compilation/reload phase.

    Make sure it's not something like that, like an editor script that does something with the AssetDatabase (or general File I/O) upon shutting down Playmode (or even at runtime).
     
  5. hawken

    hawken

    Joined:
    Aug 22, 2013
    Posts:
    759
    can confirm it's not.
     
  6. hawken

    hawken

    Joined:
    Aug 22, 2013
    Posts:
    759
    submitted as a bug (happens anytime I edit code in runtime)

    Thank you again
    for your bug report.


    Your bug report has been resolved as Not Qualified.​