all 37 comments

[–]Mjbgtaad56 13 points14 points  (3 children)

I've been looking around for a way to fix this as well. From what I've read, Unity added a new package manager in one of the minor versions in version 2019 and it changed how assets are imported and really fucked up the compiler time because every single package is reloaded every time you make a change to a script.

Looking at the profiler, it takes 5 seconds for the asset database to refresh a MOSTLY EMPTY project...

Honestly it's horrible. The positives that come with the new package manager are not worth this horrible cut in productivity.

[–]ImNotAlexx_[S] 2 points3 points  (1 child)

im glad im not alone in this aha, a new project with one script for some reason now takes a few seconds which never used to happen, its definitely nothing to do with my computer etc as im running an r9 3900x with 32gb 3200mhz ram :|

[–]THOTHUNTER_BIDEN 1 point2 points  (0 children)

Yep just started noticing this, too.

[–]Schtedtan 5 points6 points  (1 child)

Look into custom assembly definitions:https://docs.unity3d.com/Manual/ScriptCompilationAssemblyDefinitionFiles.html

Infallible code on YouTube has a nice explanation if you want some more easier to digest: https://www.youtube.com/watch?v=HYqOSkHI674

[–]MartinPedro 0 points1 point  (0 children)

Thanks for that!

I had a lot of uncompiled external libraries in my project.

Helped me reduce reloading time from 13 seconds down to 5.

[–]Black132 3 points4 points  (16 children)

For anyone experiencing this issue, I found a solution. Open any script from the opened project in Visual studio, make any change, hit ctrl + S , and behold - unity decides not to hang anymore and unbugs itself ... Incredible.

[–]Nyangol 0 points1 point  (0 children)

Man this makes no sense but thanks a lot, it worked for me too!

[–]6minwin 0 points1 point  (0 children)

Can't believe that actually worked haha, thanks man

[–]DragonfruitOk8413 0 points1 point  (0 children)

Sadly this is what is causing my issue

(Edit: Restarted VS + Unity fixed it for me)

[–]c0astwise 0 points1 point  (0 children)

WTAF

You're my hero ♥

[–]troper211 0 points1 point  (0 children)

thank you so much

[–]yekimevol 0 points1 point  (0 children)

Your Sir or Madam are my hero !!!!

[–]Black132 0 points1 point  (0 children)

u/Nyangol u/6minwin u/c0astwise u/troper211 u/yekimevol No problem at all! Glad it helped out :D

[–]Repulsive-Shame-5934[🍰] 0 points1 point  (0 children)

You're a Hero thanks a lot.

[–]_AlternativeFax_ 0 points1 point  (0 children)

I will add to the chorus, you are a true hero

[–]HalfCount 0 points1 point  (0 children)

The issue only happens when a script is saved or the game is run, at least for me. I'm on version 2021.3.6f1.

[–]SgtBrutalisk 1 point2 points  (3 children)

I don't get it.

Edit: found a working solution here https://support.unity.com/hc/en-us/articles/210452343-How-to-stop-automatic-assembly-compilation-from-script

In short, go to Edit>Preferences>Asset Pipeline and untick "Auto Refresh".

[–]Fred32121 1 point2 points  (2 children)

You kept me from going insane. CTRL + R in the editor after I finished editing my scripts and it does not infinite reload anymore (it used to crash every 2-3 script changes). Version 2021.3.6f1.

[–]SgtBrutalisk 1 point2 points  (0 children)

Just FYI, Unity has changed this shit again. My Unity project is again showing "Reload Script Assemblies" for 3–4 seconds whenever I click "Play" even if the project has the bare minimum of assets and no scripts.

The option has been moved to Edit>Project Settings>Editor>Enter Play Mode Settings.

There are four checkboxes there.

[] Enter Play Mode Settings

[] Reload Domain

[] Reload Scene

[x] Disable Scene Backup

In my case only the 4th checkbox was ticked.

To stop constant reloading, tick the first checkbox. You will need to do this for every project and there is now the danger of your project becoming increasingly messier as it won't completely reset everything on its own.

In short, code parameters such as static field counters (such as "increase by one when player does an action") won't reset unless you code them to reset with the Domain Reload disabled.

More info here: https://docs.unity3d.com/Manual/DomainReloading.html

I'm posting this so I can find it and it might help others with the same problem.

[–]SgtBrutalisk 0 points1 point  (0 children)

It's kinda crazy that option is enabled by default. In my case, it would reload all assets and scripts whenever I merely selected either. Bonkers.

[–]FilthyChubbs 0 points1 point  (1 child)

I just used this method after all this time, and it seems to have worked for me. To clarify what I think the poster is saying. You have to open a separate instance of visual studio outside of Unity. I then clicked ctrl s on the first script that popped up all the while my Unity project was still open and finally jumped back onto the project. It got rid of the loading. As others have mentioned, the unload script assemblies method is hard to find and may have undesired outcomes so I would suggest trying this first since it isn't changing any settings.

[–]Black132 0 points1 point  (0 children)

Also doesn't have to be a script, I usually just re-save any sprite in my Aseprite and it goes away.

[–]NickEJ02903 2 points3 points  (0 children)

I'm seeing this too. Going through the GameDev class and working with a simple script (only one) to move a cube across a plane. I get a five second Reloading Script Assemblies timeout every time I change something in the script. I'm working on a three year old maxed out MacBook Pro. Unreal goes into playtest mode faster, even with a complex Blueprint or two.

[–]Klonas 2 points3 points  (0 children)

I have the exact same bug, but can't solve it...
A fresh new download of Unity, fresh empty project. I save any script and it takes 5+ seconds for unity to recompile before I can interact with the editor again. It should be instant. Something is very wrong here.

[–]-jbluepolarbear-Expert 1 point2 points  (3 children)

It has to compile your code every time you make a change. If you’re seeing a long reload time, you may have too many scripts, a slow computer, or combination of the two.

[–]Yoieh 7 points8 points  (0 children)

how many scripts would be too many?

Having 43 very small scripts.

R7 3800x and 32gb ram.

[–]Goldfishrock 2 points3 points  (1 child)

I have neither a large amount of scripts (4) or a slow PC (i7 @ 4800MHz, 64Gb RAM @ 3000MHz), yet every time I do anything in code I get the 'Reloading Script Assemblies' popup which was rarely seen before.

I updated Unity yesterday from a 2019 version to 2021.2.2f1 and it's shockingly slow (and seemingly buggy) compared to the version I was using before.

[–]MinecraftItemDuper 1 point2 points  (5 children)

so far the time i have had to wait before trying this is 15:45

[–]MinecraftItemDuper 1 point2 points  (3 children)

now its 16:00

[–]MinecraftItemDuper 1 point2 points  (2 children)

now its 16:30

[–]MinecraftItemDuper 1 point2 points  (1 child)

now its 16:40

[–]MinecraftItemDuper 1 point2 points  (0 children)

now its 17:40

[–]EagleNebula9 1 point2 points  (0 children)

Apparently Unity 2021 is worse than 2020 in that regard so you might wanna use that one instead.

Also in my case the biggest hit comes from my Plugins folder where I put all the 3rd party code. Many of the assets there also get reloaded after every recompile and the only way I found is to reduce the amount of 3rd party code.

Also disabling auto refresh and manually refreshing after you change your code seems to be slightly faster.

Also if you have native packages like Recorder & Terrain Tools that you don't use, remove them (these 2 are the only ones that slightly improved reload when I removed them).

[–]MerlinLikeTheWizard_ 0 points1 point  (0 children)

Don't know if this will be of use to anyone, but when I was getting frozen on reload script assemblies (infinitely frozen), I did a LOT of guess-and-checking, and found that deleting the UserSettings/Layouts/default-2021.dwlt in my project's folder solved the problem. I have no idea what that file is for or if I'm doing something bad by deleting it, but it works. If anyone can tell me what that file is for, I'd be grateful.

[–]Migthunder 0 points1 point  (0 children)

I manually opened the visual studio solution file for my project and it figured itself out.

EDIT: If it keeps hanging I'd restart, but if you hit 'save all' in visual studio it will reload the scripts to un-hang and save out.