Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

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

    434 vote(s)
    53.5%
  2. No

    10 vote(s)
    1.2%
  3. Yes and does NOT crash/stop responding

    367 vote(s)
    45.3%
  1. RavenLiquid

    RavenLiquid

    Joined:
    May 5, 2015
    Posts:
    44
    I also have this super annoying issue. I found the same fix as webik150, and I also found that if you don't have visual studio open and Unity hangs at the reload script assemblies window, opening the project and pressing save still works.

    This might save you if you have unsaved changes in the editor and don't want to loose them.

    I also have to say that if it happens, it also happens to me the next time I press play (so the VS fix without exiting the editor).

    Also I use 2021.2.14F1.
     
  2. solkyoshiro

    solkyoshiro

    Joined:
    Aug 25, 2021
    Posts:
    27
    Is there any news on if this has been looked into? I'm having the same issue with almost 20 minute long Reload Script Assemblies.
     
  3. nOograss

    nOograss

    Joined:
    Feb 22, 2012
    Posts:
    10
    Just found this temp fix aswell a few days ago, you're message should be tagged as [Temp Fix] on top of this thread :D
    If you get the assembly issue when Unity first start, just do the save action above, kill Unity and restart
     
  4. LilGames

    LilGames

    Joined:
    Mar 30, 2015
    Posts:
    565
    It just started doing this to me (seemingly randomly?) ever since I migrated over to Plastic SCM as source control.
    Unity 2021.2.8f1

    I'll try upgrading.
     
  5. Elijahdanie

    Elijahdanie

    Joined:
    Jul 13, 2018
    Posts:
    5
    I am having this issue with Unity 2021.3 LTS i am thinking of moving back to unity 2020
     
  6. lacas8282

    lacas8282

    Joined:
    Apr 25, 2015
    Posts:
    136
    I had this issue. Unity 2020.3.33f1 and with the newest Rider under Windows 11.

    I disabled automatic directory monitoring in unity and disabled autorefresh in unityeditor rider settings and now it is working. Not crashing with 20 GB usage and loading time is between 5-10 sec
     
  7. lacas8282

    lacas8282

    Joined:
    Apr 25, 2015
    Posts:
    136
    By the way Unity is weird. If I hit play button then first time the Windows Unity editor 's memory usage 2.5 GB, after 20-30 hit in play button I get a 7-8 GB usage.
    If I save the scene the memory go up by 2-3GB and down a little. So basically Unity has a memory leak? More and more run the game the editor just eating up the memory.
     
  8. lacas8282

    lacas8282

    Joined:
    Apr 25, 2015
    Posts:
    136
    I was in a hurry, it looks like the issue come back today :D
    I just created a bigger terrain, and boom, the memory increases issue come back.
    When I want to resize the 2048px texture to 512px, the editor just hanging, increases the memory to 23 GB! And sometimes crashing, sometimes just freeze

    1, If I first run the game with this big scene, than the editor freezing
    2, If I first change to scene2, play button (smaller scene) -> run, than change to scene1 (bigger) -> run!
    3, If I edit something in th Rider editor, then run again -> freeze/crash
     
  9. KevapAereo

    KevapAereo

    Joined:
    Jul 1, 2017
    Posts:
    1
    After reading your comment, I remembered I was recently forced to migrate to Plastic SCM too… and I kinda understood what's going on.

    Surprise, surprise! The integration plugin of Plastic SCM is buggy trash!

    So, do any of the following if your Editor freezes with 'Reload Script Assemblies' after migrating to Plastic SCM:
    _____

    1 - If you really want the Editor integration (Not recommended):


    Downgrade to Version Control 1.15.9. (Or any earlier version)

    The "Reload Script Assemblies" freeze crap should stop appearing. You'll still see the popup here and there, but it'll take like 5 seconds to disappear instead of H O U R S. You may still experience freezes, but those should be rare.

    Either way, if they get too common, just proceed with option 2.

    2 - If you don't care about integration (Recommended):

    Just uninstall the broken mess of a plugin and rely on the PlasticSCM app/server thing completely.

    You should see the difference immediately. I don't even know how the plugin tries to keep track of your project, but that process seems to be what freezes Unity when pressing Play, when compiling scripts and even when trying to exit the Editor.
    _____

    Way to go, Unity!

    If forcing broken version control migrations and releasing buggy LTS versions is not enough and you guys need more ideas to mess up with your clients, I'd recommend adding even more constant flickering to the macOS Editor to make it 100% unusable!
     
    Last edited: Apr 25, 2022
    SammmZ, Zahmahkibo and LilGames like this.
  10. scaprio

    scaprio

    Joined:
    Apr 1, 2015
    Posts:
    2
    A quick workaround for me is to save any script file i have open in VS2022 and it will continue. Or if VS2022 is not open then just by opening it will make the popup continue execution.
     
    LilGames likes this.
  11. mahdiii

    mahdiii

    Joined:
    Oct 30, 2014
    Posts:
    856
    Over and Over and again Over
     
  12. homerender

    homerender

    Joined:
    Sep 14, 2012
    Posts:
    189


    That helps me on Unity 2021.3.0f1 (Android), thanks a lot!
     
    Alonelys likes this.
  13. Deleted User

    Deleted User

    Guest

    Capture d’écran_2022-04-26_16-18-14.jpg
     
  14. quitebuttery

    quitebuttery

    Joined:
    Mar 12, 2011
    Posts:
    327
    Still happens on latest 2021 LTS -- 2021.3.1f1. No fix in sight. Turned off directory monitoring to no avail. The latest version control plugin (1.15.17) does not fix this either. Probably going to tear the plastic plugin out of the project. It's weird how Unity can't make a functioning version control system when they own both the engine and the version control system.

    How do you rollback to the alleged working version? I don't see a way to install older versions via the package manager.
     
  15. qCring

    qCring

    Joined:
    Jan 9, 2017
    Posts:
    7
    Disabling the Domain Reload and Scene Reload settings (under Project Settings / Editor / Enter Play Mode Settings) did the trick for me. This way, Unity will not reload the whole C# assembly / scene context when entering play-mode and you can work normally again.

    However, that's just a work-around. You might need to make some small adjustments in your code at application startup / script initialization. In my case some fields were not reset properly but it's relatively easy to fix.

    Just enable Enter Play Mode Options and leave domain and scene reloading unchecked:

    Screenshot 2022-05-06 at 10.23.31.png
     
  16. sisF

    sisF

    Joined:
    Dec 10, 2020
    Posts:
    4
    OMG, you save my time. Using your method makes me enter play mode almost immediately.
     
    stestar and qCring like this.
  17. shuskry

    shuskry

    Joined:
    Oct 10, 2015
    Posts:
    462

    Thanks to you !!! It's pleasur to see my project play instantly :D !!!
     
    stestar and qCring like this.
  18. alexlukensSH

    alexlukensSH

    Joined:
    Jan 19, 2022
    Posts:
    14
    What is going on with this? Why is no Unity rep chiming in in this thread? This is a serious problem with the 2021.3 LTS and plastic.
     
  19. paparape

    paparape

    Joined:
    Apr 5, 2022
    Posts:
    4
    Nice, just meet this bug. Removing VCS plugin, disabling Domain and Scene reload and Directory monitoring does not help.
     
  20. SharpAccent

    SharpAccent

    Joined:
    Jul 19, 2018
    Posts:
    39
    I don't know if it will help everyone but for me I solved it by removing all the generates .csproj files and then deleting every .sln and .csprj in the project file so Unity regenerates those. It went from infnite loading to less than a second play

    upload_2022-5-16_19-55-41.png
     
  21. wechat_os_Qy07oG6LBuLwxrt0ao4ZkEwPc

    wechat_os_Qy07oG6LBuLwxrt0ao4ZkEwPc

    Joined:
    Jun 28, 2021
    Posts:
    17
    Me too , I use the 2021.3 Version.
     
  22. wechat_os_Qy07oG6LBuLwxrt0ao4ZkEwPc

    wechat_os_Qy07oG6LBuLwxrt0ao4ZkEwPc

    Joined:
    Jun 28, 2021
    Posts:
    17
    Cool! Thanks to you !!!
     
  23. jimfhurley

    jimfhurley

    Joined:
    Mar 6, 2015
    Posts:
    7
    I also use the visual studio save technique when this happens.
     
  24. MaximPP

    MaximPP

    Joined:
    Jan 26, 2019
    Posts:
    76
    I ran into this issue after upgrading from 2020.3.33 to 2021.3.2. "Reload Script Assemblies" EVERY time I press play, even if there were no changes to the project. Enabling Enter Play Mode Options worked for me! But what will be the side effects? Why is this checkbox not checked by default?
     
  25. Havokki

    Havokki

    Joined:
    Jun 28, 2015
    Posts:
    118
    Static variables are not reset when using that, which breaks many 3rd party plugins.
     
  26. RobertOne

    RobertOne

    Joined:
    Feb 5, 2014
    Posts:
    258
    really looking forward to all the „why is xyz not working anymore“ posts that can be all backtracked to enabling the new playmode options.

    The problem is, that you usually wont get any errors at all. Stuff just start to behave weird. When dotween wasn’t optimized for the new playmode options (now is) it just stoped to tween things from a to b on the second start. So i was spending an hour figuring out why my tweens wont work anymore until i remembered i enabled the fast playmode options
     
  27. spiney199

    spiney199

    Joined:
    Feb 11, 2021
    Posts:
    7,612
    On top of this, non-serialised fields of Scriptable Objects won't reset either. So depending on how much you rely on those, you could experience some strange behaviour.
     
  28. MaximPP

    MaximPP

    Joined:
    Jan 26, 2019
    Posts:
    76
    So this is not a solution to the problem. How ironic that I read in the blog how well the Unity team did to speed up workflow, and when I upgrade to the latest LTS version, I get this problem with a slow entering play mode.
     
    Last edited: May 23, 2022
  29. MaximPP

    MaximPP

    Joined:
    Jan 26, 2019
    Posts:
    76
    I compared the launch of two empty projects 2020 LTS and 2021 LTS. Perhaps the slow start of play mode was in the 2020 too. It's just that in that version the message "Reload Script Assemblies" was not displayed, but simply silently hangs for a couple of seconds:)
     
  30. Ryan-Unity

    Ryan-Unity

    Joined:
    Mar 23, 2016
    Posts:
    1,993
    Hi everyone, we just released 1.14.18/1.15.18 of the Version Control package with a fix that should address this Editor hang at startup and when pressing play. Can you please download the latest Version Control package via the Package Manager and see if this resolves your issue?
     
    LilGames likes this.
  31. MaximPP

    MaximPP

    Joined:
    Jan 26, 2019
    Posts:
    76
    I'm not using the Version Control package and it still hangs
     
  32. Sortof

    Sortof

    Joined:
    Jun 3, 2022
    Posts:
    2
    @Ryan-Unity I have the new patch of the version control package and I'm still getting the "Reloading scripts..." message every time I press play, and every time I change anything in a script in Visual Studio 2019.

    I can't find any workarounds that don't compromise the integrity of the entire editor.

    I'm using Unity 2021.3.4f1

    Really hoping for a solution soon
     
  33. Ryan-Unity

    Ryan-Unity

    Joined:
    Mar 23, 2016
    Posts:
    1,993
    @Sortof can you confirm if you still experience the "Reloading scripts..." message when pressing play if the Version Control package is removed from the Package Manager? I just want to confirm if that package is the cause of your experience.
     
  34. LilGames

    LilGames

    Joined:
    Mar 30, 2015
    Posts:
    565
    I haven't experienced it in a few days now.
     
  35. Sortof

    Sortof

    Joined:
    Jun 3, 2022
    Posts:
    2
    @Ryan-Unity I removed the version control package from the package manager and I still get the message under all the same circumstances.

    The only way I don't get the messages is if I enable "Enter play mode options" inside the editor tab within project settings, and disable "auto refresh" and "directory monitoring" in the asset pipeline preferences.

    Enabling "Enter play mode options" gets rid of the "Reloading scripts..." message when I press the play button, and disabling the other two options in asset pipeline gets rid of the message when I change something in Visual studio.

    The visual studio message fix is redundant though since I have to manually refresh if auto refresh is turned off, and it still gives the "Reloading scripts..." message even then.

    I read that enabling "Enter play mode options" is not very good for the long term support of your project so I'm opting not to do that before I get ahead of myself, but that does effectively eliminate the message when I press play.

    I really have no suspicions what the cause could be because I just started Unity a few days ago, but this bug is making it really hard to get my foot in the door when I know these messages shouldn't be popping up every time I edit something or want to test something. Let me know if there's anything else you might think it could be.
     
  36. Ryan-Unity

    Ryan-Unity

    Joined:
    Mar 23, 2016
    Posts:
    1,993
    @Sortof, thank you for checking whether the Version Control package was the source of the message constantly appearing. Unfortunately, I'm not familiar enough with the script compilation aspect of the Editor to make helpful suggestions on what to check next, but I'll ping the Editor team to investigate this issue further.
     
  37. HaraldNielsen

    HaraldNielsen

    Unity Technologies

    Joined:
    Jun 8, 2016
    Posts:
    136
    We dont know of any issues on 2021.x sadly. We have not heard of an issue with entering Playmode. Can someone report a bug. I understand its hard when the Editor is locked, but after it happened, reopen the Editor and report it. We include the Editor log from the previous session
     
    LilGames likes this.
  38. LunarExGames

    LunarExGames

    Joined:
    Feb 18, 2015
    Posts:
    44
    Cleaning the GI Cache did it for me... was happening in 2021.3.2
     
  39. lukshan13

    lukshan13

    Joined:
    Oct 7, 2020
    Posts:
    2
    Is there a fix in the pipeline? I've tried every fix and I can't seem to figure it out. From what I understand, this occurs on the second script assemblies reload. When the scripts are reloaded for the first time (whether that's playing the scene or after saving changes to a script) it works perfectly fine, but when reloaded for the second time, it hangs.
     
  40. lukshan13

    lukshan13

    Joined:
    Oct 7, 2020
    Posts:
    2
    I managed to fix it! (for me, at least!) After hours of debugging, I realised that it was not happening when I unloaded all of my scripts. Here's an outline of what I discovered.

    I'm using GRPC as part of the game. The game makes a connection to a remote server, and on stopping playing the game, it will hang the next time I attempt to play the game. We realised that because we were not properly closing the channel and stream we were using, it was causing the editor to somehow crash when trying to load again.

    Our solution was to make sure the channel is properly closed, by calling the close function AND then Wait on it to close before doing so. The same was with the stream, making sure that the dispose function was called. This problem was unique to me, but I think a potential core of the problem could be mishandling of resources and not properly returning them when stopping playing.
    1. The garbage collector does not automatically clean up the connections when stopping the game within the editor
    2. Unresolved open resources interferes with the editor and cause it to hang.

    Curiously, it doesn't hang when I tick the editor play mode settings and don't reload the domain or scene. Perhaps there's a bug within the reloading scripts that waits for all resources to be released? Thought that info might help devs :)

    My tip would be to check if you are managing any resources, such as files or network connections, try disabling it and see if your editor doesn't hang anymore. If that fixes it, make sure that you close out the resources properly (I put my cleaning up logic within the onDestroy method). Please don't hesitate to ask me any questions!
     
    HaraldNielsen likes this.
  41. Hamza62

    Hamza62

    Joined:
    Jul 12, 2018
    Posts:
    1
    Its available under Prefernces => Asset Pipline
     
  42. y4my4m

    y4my4m

    Joined:
    Jul 30, 2014
    Posts:
    7
    Same. It's impacting my development time by a lot.
     
    Last edited: Jun 28, 2022
    Ruslank100 likes this.
  43. DCarco

    DCarco

    Joined:
    Aug 19, 2019
    Posts:
    1
    Hello there,

    I had the same issue, (15-38 minutes with "Reload script assemblies" window). Immediately I opened Visual Studio Unity stopped to reload.
     
  44. mica2727

    mica2727

    Joined:
    Nov 26, 2014
    Posts:
    19
    Vous pouvez contrôler les rechargements des assemblies vous même il suffit d'ajouter ça :

    Vous devrez cliquer sur ce bouton chaque fois après la mise à jour de vos scripts, comme ça vous contrôler vous même quand Unity recompile.

    Code (CSharp):
    1. #if UNITY_EDITOR
    2. using UnityEditor;
    3. public class AssetPipelineReloadEditor : Editor {
    4.         [MenuItem("Window/ControlAsset/AssetPipelineReloadEditor")]
    5.         public static void AssetPipelineReload() {
    6.             AssemblyReloadEvents.afterAssemblyReload += AssemblyReloadEventsOnafterAssemblyReload;
    7.      
    8.             AssetDatabase.Refresh();
    9.             EditorApplication.UnlockReloadAssemblies();
    10.         }
    11.  
    12.         // Block le rechargement des assets après qu'il soit chargé.
    13.         private static void AssemblyReloadEventsOnafterAssemblyReload() {
    14.             AssemblyReloadEvents.afterAssemblyReload -= AssemblyReloadEventsOnafterAssemblyReload;
    15.             EditorApplication.LockReloadAssemblies();
    16.         }
    17.     }
    18. #endif
     
    Last edited: Jul 8, 2022
  45. DumbleSteve

    DumbleSteve

    Joined:
    Apr 5, 2013
    Posts:
    1
    Is a f***king disgrace on Unity's part. Completely screwed a previously solid app and made it virtually unusable!

    No word from any Unity people? What are you thinking? Fix it!!!!!!!

    I'm a lecturer in Game Dev and my students want to change to Godot because Unity has become so crap because of this constant interruption in development. I can't really argue. It's hard for me to get the uni I work at to downgrade to an older version as they have a policy across all compuses.

    Shame on Unity.
     
    a17714375388, xucian, uvs42 and 2 others like this.
  46. MichaelPickering

    MichaelPickering

    Joined:
    Oct 11, 2017
    Posts:
    14
    I'm having this problem too, with latest 2021.3.LTS release. Tried all the suggestions but none worked -- it may even be worse now! I will try to file a bug report soon...
     
  47. m0guz

    m0guz

    Joined:
    Mar 4, 2015
    Posts:
    31
    This issue is killing our productivity. After all these IL2CPP compilation improvements, assembly definition, assetdatabasev2 etc. all of them made Unity development worse.

    Main culprit is AssetDatabasev2 most of the time. This isn't related to project either, if I create new project, popup will be shown as soon as I create a script file.

    Script file changed, Unity compiled and done.
    Code (CSharp):
    1. Asset Pipeline Refresh: Total: 7.691 seconds - Initiated by RefreshV2(AllowForceSynchronousImport)
    2.     Summary:
    3.         Imports: total=0 (actual=0, local cache=0, cache server=0)
    4.         Asset DB Process Time: managed=0 ms, native=301 ms
    5.         Asset DB Callback time: managed=34 ms, native=0 ms
    6.         Scripting: domain reloads=1, domain reload time=5222 ms, compile time=2131 ms, other=0 ms
    7.         Project Asset Count: scripts=7118, non-scripts=10507
    8.         Asset File Changes: new=0, changed=0, moved=0, deleted=0
    9.         Scan Filter Count: 0
    10.     InvokeBeforeRefreshCallbacks: 0.345ms
    11.     ApplyChangesToAssetFolders: 0.068ms
    12.     Scan: 1.286ms
    13.     OnSourceAssetsModified: 0.001ms
    14.     InitializeImportedAssetsSnapshot: 26.955ms
    15.     GetAllGuidsForCategorization: 3.503ms
    16.     CategorizeAssets: 177.529ms
    17.     ImportOutOfDateAssets: 7376.326ms (5236.558ms without children)
    18.         CompileScripts: 2131.427ms
    19.         EnsureUptoDateAssetsAreRegisteredWithGuidPM: 5.562ms
    20.         InitializingProgressBar: 0.000ms
    21.         PostProcessAllAssetNotificationsAddChangedAssets: 1.937ms
    22.         OnDemandSchedulerStart: 0.842ms
    23.     ReloadSourceAssets: 5.362ms
    24.     UnloadImportedAssets: 6.524ms
    25.     PostProcessAllAssets: 34.216ms
    26.     GatherAllCurrentPrimaryArtifactRevisions: 1.599ms
    27.     UnloadStreamsBegin: 0.268ms
    28.     LoadedImportedAssetsSnapshotReleaseGCHandles: 3.728ms
    29.     GetLoadedSourceAssetsSnapshot: 7.174ms
    30.     PersistCurrentRevisions: 1.276ms
    31.     UnloadStreamsEnd: 0.040ms
    32.     GenerateScriptTypeHashes: 5.211ms
    33.     Untracked: 78.535ms
    Pressing play after script compilation done;
    Code (CSharp):
    1. Asset Pipeline Refresh: Total: 4.514 seconds - Initiated by StopAssetImportingV2(ForceSynchronousImport | ForceDomainReload)
    2.     Summary:
    3.         Imports: total=0 (actual=0, local cache=0, cache server=0)
    4.         Asset DB Process Time: managed=0 ms, native=312 ms
    5.         Asset DB Callback time: managed=35 ms, native=0 ms
    6.         Scripting: domain reloads=1, domain reload time=4163 ms, compile time=2 ms, other=0 ms
    7.         Project Asset Count: scripts=7118, non-scripts=10507
    8.         Asset File Changes: new=0, changed=0, moved=0, deleted=0
    9.         Scan Filter Count: 0
    10.     InvokeBeforeRefreshCallbacks: 0.465ms
    11.     ApplyChangesToAssetFolders: 0.072ms
    12.     Scan: 0.001ms
    13.     OnSourceAssetsModified: 0.001ms
    14.     InitializeImportedAssetsSnapshot: 41.621ms
    15.     GetAllGuidsForCategorization: 5.571ms
    16.     CategorizeAssets: 196.974ms
    17.     ImportOutOfDateAssets: 4182.462ms (4173.269ms without children)
    18.         CompileScripts: 1.592ms
    19.         EnsureUptoDateAssetsAreRegisteredWithGuidPM: 5.027ms
    20.         InitializingProgressBar: 0.000ms
    21.         PostProcessAllAssetNotificationsAddChangedAssets: 1.615ms
    22.         OnDemandSchedulerStart: 0.959ms
    23.     ReloadSourceAssets: 5.181ms
    24.     UnloadImportedAssets: 3.226ms
    25.     PostProcessAllAssets: 35.482ms
    26.     GatherAllCurrentPrimaryArtifactRevisions: 0.951ms
    27.     UnloadStreamsBegin: 0.082ms
    28.     LoadedImportedAssetsSnapshotReleaseGCHandles: 2.501ms
    29.     GetLoadedSourceAssetsSnapshot: 9.908ms
    30.     PersistCurrentRevisions: 0.692ms
    31.     UnloadStreamsEnd: 0.033ms
    32.     GenerateScriptTypeHashes: 5.218ms
    33.     Untracked: 63.777ms
     
  48. drallcom3

    drallcom3

    Joined:
    Feb 12, 2017
    Posts:
    163
    I'm getting a lot of reloading. 2022.2.0b3, but with the latest versions of 2022.1 or 2021 it's the same.
    Something reloads when I hit save in my IDE, even with Directory Monitoring disabled.
    When I enter Unity, it reloads (scripts, assemblies, domain) again and for much longer (even though it reloaded in the background..). Why does it reload assemblies I haven't touched? I thought the point of assemblies was to avoid that.
    Then when I enter play mode, it reloads everything for a third time.

    Also Unity does this during play mode and there is no option anymore to stop that. Highly annoying.
     
  49. noob101

    noob101

    Joined:
    Nov 3, 2013
    Posts:
    38
    Any news on the bug report ? This issue is still happening on LTS 2021.3.9f1
     
  50. Comrad_Squirrel

    Comrad_Squirrel

    Joined:
    May 28, 2016
    Posts:
    20
    On 2022.1.16f1, just started a new project and since the beginning I'm seeing the 'reload script assemblies' every time I edit my code and switch to Unity (from VS) and every time I press play.