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. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice
  3. Join us on November 16th, 2023, between 1 pm and 9 pm CET for Ask the Experts Online on Discord and on Unity Discussions.
    Dismiss Notice
  4. Dismiss Notice

Unity 'not responding' when compiling starts while in playmode

Discussion in 'Editor & General Support' started by TS-Trooper, Mar 15, 2021.

  1. TS-Trooper

    TS-Trooper

    Joined:
    Apr 30, 2019
    Posts:
    15
    I hope the title says all, but let's explain it a bit further.

    Say I have Unity open and have Visual studio open at the same time. I just created some code and go to Unity. It compiles the code and I can start Playmode.
    While in playmode I notice something. I go back to visual studio change it and go back to Unity.

    Normally Unity recognizes the change starts compiling and voila. it does whatever is set in the preferences (exit playmode before compile, continue playmode or even wait for playmode to stop before recompiling)

    What it does for me: Freeze up. The only way to get out is opening task manager and force quitting the not-responding Unity task.

    Some background information:
    This started happening in an existing project at some point. I work on Windows
    The problem started in this project on Unity 2019.4.10. It persisted through an upgrade to 2019.4.18.
    I have not been able to reproduce it in a smaller/empty project, though What i did notice there is that Unity secretly already starts compiling before playmode exits. (more elaborate post here: https://forum.unity.com/threads/inspector-gets-stuck-when-recompiling-during-play-mode.794151/)

    I have tried:
    - reinstall Unity (even if upgrading is already a reinstall in a way)
    - remove the Library folder to force Unity to re-import assets)
    - Clicked reimport all in the context menu in the project view.
    - change the settings around in the preferences on the recompile behaviour.
    - Also I tried waiting, but that didn't have any effect after several hours.

    Nothing has helped so far. I still try to get it into my system to stop playmode before making changes, which is harder than you might think :p
     
  2. garrett_b

    garrett_b

    Joined:
    Oct 14, 2020
    Posts:
    24
    Maybe try looking into your unity project's folder permissions? Try making everything full-read and write.

    Also, check the history of your asset package updates. Maybe this failure to recompile in play mode is a recent problem introduced by a third party asset?

    Have you introduced any new assembly definitions that might be referencing some other assemblies in a weird (maybe circular way?)

    Have you introduced any custom build scripts to your project?
    Any custom editor tools?

    Also, when you run your application in the player, do you mean the unity editor's player, or a standalone player build?
     
  3. TS-Trooper

    TS-Trooper

    Joined:
    Apr 30, 2019
    Posts:
    15
    Thanks for you reply. I will check these things.
    As to clarify; I meant the editor's player.

    Furthermore, my colleagues don't have these issues, making me think this is not something related to packages or assemblies.
    I could try an entire new git-clone. though I suppose it has the same outcome as deleting the library folder.
     
    Last edited: Mar 16, 2021
  4. garrett_b

    garrett_b

    Joined:
    Oct 14, 2020
    Posts:
    24
    I think the fresh git-clone is a good idea.

    I have had a single occurrence of a problem where my application was behaving wonky and not responding to code changes, but then I deleted some meta files in the files I was changing and Unity "fixed itself". Unity gets weird when the meta files get mucked up. If your fresh git clone fixes your issue, my bet would be on meta file problems.
     
  5. TS-Trooper

    TS-Trooper

    Joined:
    Apr 30, 2019
    Posts:
    15
    It took a while, but I got around to making a fresh git-clone.
    Sadly it still happens :(

    So it may be assemblies being referenced in a circular way? How can I debug something like that?
    I still find it really odd that my colleagues don't experience this.
     
  6. TS-Trooper

    TS-Trooper

    Joined:
    Apr 30, 2019
    Posts:
    15
    At long last I installed Visual Studio 2019, I was using 2017. That fixed the issue.
    Possibly a reinstall of 2017 would have sufficed.

    Edit: Nevermind. Just now I encountered the issue again. Earlier I tested it by adding a whitespace somewhere in code and press save. Now that I actually removed some lines and saved, it stalls again.
     
    Last edited: Apr 1, 2021