Search Unity

  1. We are migrating the Unity Forums to Unity Discussions. On July 12, the Unity Forums will become read-only.

    Please, do not make any changes to your username or email addresses at id.unity.com during this transition time.

    It's still possible to reply to existing private message conversations during the migration, but any new replies you post will be missing after the main migration is complete. We'll do our best to migrate these messages in a follow-up step.

    On July 15, Unity Discussions will become read-only until July 18, when the new design and the migrated forum contents will go live.


    Read our full announcement for more information and let us know if you have any questions.

Constant, incessant"Reload Script Assemblies" - Program crashing, hanging

Discussion in 'Editor & General Support' started by Smileyfrown, Feb 14, 2021.

?

Does your Unity constantly "Reload Script Assemblies"

  1. Yes and crashes/Stops responding

    441 vote(s)
    53.6%
  2. No

    11 vote(s)
    1.3%
  3. Yes and does NOT crash/stop responding

    371 vote(s)
    45.1%
  1. spiney199

    spiney199

    Joined:
    Feb 11, 2021
    Posts:
    8,647
    That's completely normal. Unity has to perform a domain reload when you edit code, and when you enter play mode (unless you change the options for this in project settings).
     
  2. StevenGuo2022

    StevenGuo2022

    Joined:
    Sep 15, 2022
    Posts:
    1
    When running the Editor, once the c # script is rewritten and then switched back to the Editor, the Editor will always be stuck in Reload Script Assemblies. I tried to replace 2020.3.38f1c1 and 2022.1.16f1c1, both of which are the same.

    To make a trial, I just changed the name of an empty class in C #, and the same situation will occur. After killing the Editor process, restart the Editor, and it can be loaded and run normally. However, once the C # script is modified, the same situation will occur again.

    This problem only occurred yesterday. When I wrote the script again yesterday, there was an endless loop. I forced the Editor process to be killed, and then a similar situation occurred. When I created a new project, the same situation also occurred, even if there were only a few short codes. Completely collapsed!!!!!
     
  3. Seltzer

    Seltzer

    Joined:
    Jan 21, 2015
    Posts:
    5
    See my answer here with some things to try that at least partially worked for me: https://forum.unity.com/threads/rel...nd-keeps-getting-slower.1228698/#post-8484515

    My general diagnosis is if more than one thing triggers an automatic reload while a reload is occurring, it'll usually freeze and I'll need to restart the editor. I haven't managed to stop it from freezing regularly, but I've managed to reduce the frequency of freezing greatly by changing some preferences in Unity and my IDE.

    Can't say for sure if it'll work for everyone. I'm sure there are more things I could try too. Let me know if this works for anyone else!
     
  4. SquadMc

    SquadMc

    Joined:
    May 29, 2017
    Posts:
    6
    Hey all, I had this problem constantly since updating to 2021.3.4f1.

    Thanks to you guys I looked into the preferences and out of a gut feeling I disabled Editor Analytics (check the checkbox at Edit > Preferences > General > Disable Editor Analytics). Problem gone so far for me.

    Hope that helps somebody. Just wanted to drop it here for people to stumble over. Live long and prosper!
     
    Seltzer likes this.
  5. shinymerlyn

    shinymerlyn

    Joined:
    Sep 25, 2020
    Posts:
    13
    We had this problem on my company's current 2021.3.x project. I ran a profiler on the editor and figured out that it was during scriptable object unload and reload, due to some bad behavior in code being called from our SOs during initialization.

    Considering how intermittent this problem is, and how project specific the solutions might have to be, I bet a lot of folks in this thread could benefit from learning how to use a profiler to diagnose this type of problem, and make sure it isn't any of your own project's code (or any of the third-party plugins you are using!) that are causing the issue.

    Unity's profiler doesn't show a lot of detail below a certain part of the callstack, but it did show in my case that the specific SOs were taking a lot of time in their copy constructors. A third-party profiler (Superluminal) told me exactly which portion of the copy constructor was causing the issue because it gives a ton more granular data.

    An interesting aside - the long reload times on my project seemed to be exacerbated by having things that contained SOs active. I noticed Project-wide type search to cause particularly long times (e.g. "t:MyScriptableObjectType"). This says to me that one diagnostic step might be to clear out your searches and only have some empty folder/non-SO-containing directory active. Or just closing the project tab. Maybe the inspector tab and the scene as well :p If the script reload times improve significantly when all that stuff is closed, you may be running into similar problems to me. And the very long load times also abated in my case very shortly after detaching the debugger.

    I wonder if Unity could detect cases like this and give the user some warning that SO copy-initialization is taking a long time? It seems fairly hard to pinpoint, since no error gets spit out just because they're running slow, and the consequences on productivity seem pretty dire. Putting up the error message "Reload Script Assemblies (busy for 10 years)" IMO is a bit too opaque for most people to figure out the problem is in their SO initialization code. I don't know if it's out of Unity's hands at the point in appdomain reload code where the user CCTORs are executed, but if you can actually do a runtime watchdog at that level then it could save users a lot of headache.
     
  6. Deleted User

    Deleted User

    Guest

    So, I've been absent for some time and I had completely forgotten about that. I install the latest LTS, and ...

    Capture d’écran_2022-10-22_19-08-58.jpg
    each time I press the Play button.

    Is this constant reloading really necessary? Will anyone look into this some time?

    Unity doesn't crash for me but this behaviour is annoying as hell.

    Edit: Linux Mint 20.3 Una, base: Ubuntu 20.04 focal.
     
    Last edited by a moderator: Oct 22, 2022
  7. AnimalMan

    AnimalMan

    Joined:
    Apr 1, 2018
    Posts:
    1,164
  8. Deleted User

    Deleted User

    Guest

  9. AnimalMan

    AnimalMan

    Joined:
    Apr 1, 2018
    Posts:
    1,164
    Ah

    works for me.
    I assume it is because of security checks. I have i no clue about if Linux is scanning your scripts before they are allowed to compile. But somebody mentioned a small delay on Mac. Which also fits the idea something is scanning the files before letting Unity assemble them
     
  10. DifinityRelin

    DifinityRelin

    Joined:
    Aug 9, 2021
    Posts:
    6
    Using 2021.3.2f1 & 2020.3.40f1 I am seeing 40+ second wait times and over a minute about 20% of the time. I tried restarting Unity, restarting the IDE, restarting Windows, adding folders to Win Defender exclusions; nothing changed anything.

    What did change something was when I disconnected the debugger. I consistently see less than 10 second wait times when the debugger isn't attached, and 30+ seconds when it's attached. I use Rider, but I am seeing this with VS as well.

    Additionally, I noticed that I am NOT seeing these wait times with a new project using the same packages and imports, but has only 1 scene and very few scripts.

    My guess is that there is some sort of syncing, indexing or extraneous evaluation going on between Unity and the debugger that's causing this wait time; but I don't really have a way to find out what, yet. I will post again if I discover the culprit.
     
  11. spiney199

    spiney199

    Joined:
    Feb 11, 2021
    Posts:
    8,647
    Why would you keep the debugger attached at all times?

    Yes it's well established a larger project with more assets (not just script assets, but any kind of asset) leads to slowly growing reload times.
     
  12. joe_carrot

    joe_carrot

    Joined:
    Oct 20, 2012
    Posts:
    1
    This happens to me one out of three times I do anything. Change some code, edit the scene, anything. It just hangs, forever. I probably force quit Unity hundreds of times a day. I've tried deleting Library, reimporting assets, getting rid of all packages I am not using, nothing helps. Saving a script in VS doesn't stop the freeze for me, maybe because I am on a Mac.

    It's most frustrating because there are no logs or anything of where the Reload Script Assemblies might be hanging. It's a black box, which in my case doesn't work hundreds of times per day. This is the single issue that is leading me to tell my bosses that I cannot in good conscience recommend Unity for our projects.
     
  13. leozzyzheng2

    leozzyzheng2

    Joined:
    Jul 2, 2021
    Posts:
    66
    Same to me on windows for 2021.3.6.
     
  14. sturtsje

    sturtsje

    Joined:
    Nov 13, 2022
    Posts:
    1
    I've ran into this same issue except for me it doesn't happen when pressing play button but after loading the project from Unity Hub, it loads the project and then gets stuck on "Reload script assemblies" and shows no sign of ever completing.

    I tried the various solutions like removing temporary files inside our project's /Temp/ folder, upgrading the Version Control Package to the latest version (1.17.7) and removing the Version Control Package via creating another project (but not sure if that removes it from other projects too..), tried restarting windows, re-downloading the project, re-installing the editor but to no avail.. also tried opening the scripts in VS and re-saving them (wth kind of solution is that?!) and the other solutions which require to edit project settings I can't try since it requires access to the editor itself but the "Reload script assemblies" is preventing me from doing so..

    It seems it's just stuck on this forever

    upload_2022-11-30_2-59-23.png

    What to do? Wait for hours every time and just hope it loads the project? :(

    Deleting the files in /Temp/ worked two times but then most of the time it doesn't - 9 out of 10 times it simply won't work and I can't use the editor at all.. this is preventing me from contributing to a project we just started a few days ago and is extremely annoying..

    Are there any solutions?

    @Unity
     

    Attached Files:

    NickVas likes this.
  15. EnokV

    EnokV

    Joined:
    Apr 14, 2016
    Posts:
    56
    This S***'s REALLY annoying. Unity 2021.3.14f and every time I save a C# file i get "reloading script assemblies". This seriously needs to be addressed yesterday.
     
  16. Zahmahkibo

    Zahmahkibo

    Joined:
    Dec 31, 2018
    Posts:
    7
    Thanks a ton, this fixed my issue.

    Successfully repro'd on 2021.3.16f1 on OSX with Version Control 1.17.7.

    1) Create a blank project from the 3D template. Hit play, reloads for 3-5 seconds then finishes. No problem.
    2) Add a blank game object to scene. Enter play mode again, same result. OK.
    3) Create a PlasticSCM workspace. Hit play. Stalls for a minute or more.
    4) Downgrade VC package: (Package Manager --> Add package by name --> Name = com.unity.collab-proxy, Version = 1.15.4). Hit play. Back to 3-5 seconds.

    The long reload lockouts weren't happening every single time before this, but often enough to be a major disruption. I wasn't able to re-reproduce by going back to 1.17.7 on the test project. And removing the VC package entirely didn't seem to make a difference vs. just downgrading, except that the standalone app began crashing immediately whenever I tried to view Changesets. Whatever, good enough.
     
    mgmhunt likes this.
  17. NickVas

    NickVas

    Joined:
    Jul 28, 2017
    Posts:
    9
    I have this problem too.

    Can't open project. It's stuck on "Reload script Assemblies" while project is loading and the Editor becomes "Not responding", and all I left to do is use "Force quit". So, I can never get to the project settings...

    What can I try to resolve this?

    2021.3.19f1
     
  18. luis_unity981

    luis_unity981

    Joined:
    Oct 11, 2022
    Posts:
    13
    How do we raise this issue to unity developers? At this point, this issue takes so much productivity away from me because I just have to sit and wait, often for 2-3min at a time, for unity to just let me work again.

    The strange thing is often times it'll reload script assemblies, i'll make no change to the project, and it'll need to reload them again when I run it. Couldn't this be solved with some sort of cache in the unity editor? I can't genuinely believe unity needs to reload scripts this many times
     
  19. m0guz

    m0guz

    Joined:
    Mar 4, 2015
    Posts:
    32
    I think this is how Unity works now. Enabling Play Mode Settings seems to be only option that works with few caveats.
     
  20. luis_unity981

    luis_unity981

    Joined:
    Oct 11, 2022
    Posts:
    13
    I'm probably naive about the underlying issue, but I feel like an easy fix for this would just be reusing the previously loaded assemblies / data until the new assemblies / data is fully loaded, and then just giving a small non-intrusive prompt to reload the UI for the new assemblies. It just seems really unnecessary that it would need to block the entire UI for this, and also reload so many times. It makes it nearly unusable as a game engine. Also wouldn't enabling play mode settings cause runtime changes to remain after running?
     
  21. m0guz

    m0guz

    Joined:
    Mar 4, 2015
    Posts:
    32
    I am having only two issues with Play Mode right now; one is custom shader/vertex animation not working correctly, other is async/await methods isn't working every time. The issue you mention should be correct for static class/fields.

    Related topic from Unity devs: https://forum.unity.com/threads/improving-iteration-time-on-c-script-changes.1184446/
     
  22. mgmhunt

    mgmhunt

    Joined:
    Apr 1, 2013
    Posts:
    70
    Removing PlasticSCM package from Unity seemed to stop the 'Reload Script Assemblies' hang for me (latest 2.0.5 on Unity 2021.3.29f1 Mac). I was able to manually bypass the hang by adding or removing a temp folder in the project directory.... which did point to some issue with VCS.