Reloading Script Assemblies takes a long time, and keeps getting slower

On 2020.2.21f on Windows, and Reloading Script Assemblies happens every time I compile, and is now taking 40 seconds each time. With script compilation and reloading script assemblies and updating the editor, it now takes about 60 seconds every time I change a piece of code.

I recreated this project from my main project just to get this time down, and with BOTH compiling and reloading script assemblies it was at 100 seconds in the large project. The large project was big, at 150GB, and had many different code assets. So ok.

But this new project is leaned down to 9GB of assets, and a minimum number of code assets, and was only taking 10-15 seconds each recompile 1 week ago, and now it is almost as long as the huge project.

Why does Unity not cache the Script Assemblies so it doesnt need to reload them? They havent changed, they didnt need recompiling. Is there some way I can fix this?

It is drastically reducing the number of changes I can make in an hour and limiting my productivity and I dont think I can make the project any smaller and actually get the game programming done.

I have everything that isnt my personal active game code in Assemblies, so they shouldnt need recompiling, but they still take forever to reload.

About 5 seconds to compile scripts and about 43 seconds “Reloading Script Assemblies”.

7831170--991905--final1.PNG

10 Likes

Hi,

have you checked in the Profiler (via Editor Deep Profiling) what specifically in “Reloading Script Assemblies” is taking that long?

Unity also calls [InitializeOnLoad] methods during this step and perhaps there is a plugin/package/etc that is doing an expensive operation. It could also be an AssetPostprocessor that triggers when a script imports. All of this should be visible in the Profiler.

4 Likes

I didnt know it ran those during that phase. I will look into that Editor Deep Profiling for that. Thanks.

Actually, I had Wwise shut down, and it looks like it did a full TCP timeout delay during the [InitializeOnLoad] section, so once I started that its back to 5 seconds for Reload Script Assemblies.

Thanks. I’ll see if there are any other offenders, but already back to 12 seconds after recompiling scripts, which is totally acceptable.

3 Likes

I’m also having this problem. I get “Reloading Script Assemblies” any time I start or stop my project.

6 Likes

Same problem here !
40s+

Same problem here! I upgraded to 2021.3.2f1 and it went from taking a few seconds to get past “reloading ScriptAssemblies” to now around 15 minutes! I tried both upgrading and downgrading, but the problem persists in every version now. I’m not sure what to try next or how to get it back to the state it was just a day ago other than eraing all the project files other than assets and trying to rebuild from scratch. :frowning:

Same issue here. Sometimes it seems making a small amendment to a script - adding a comment - whilst it is doing its recompiling knocks it out of it and it finishes quickly. But not always.

I also have Visual Studio saying “Background analysis of asset and meta files has been disabled, because this project seems to large.”

Not sure if that’s related. It isn’t a big project at all. About 40 scripts in there, but the size of the project is not big.

2 Likes

Did the profiler thing, didn’t help cuz I have no access nor know most of the top consuming things shown there during the reload phase.
I tried removing unused plugins and packages, big & small and still 0 difference in reload time which takes about 10 secs for an avg iteration time of 19 to 34s after each even minor code change added to the 15s for enter play mode and ~6s for exiting -_-

It is an absolute pain to work with and yesterday I upgraded my 2020.3 LTS editor from 15f1 to 33f1 and was looking forward to this upgrade for a long time hoping they solved that issue and improved workflow speed but to my biggest disappointment they did not and postponed such important issue…
I heard this issue wasn’t present in 2019 and now I’m thinking about whether I can and should downgrade at the expense of losing a feature like contextual prefab editing pff…

Edit: I tried downgrading to 2019 and there was no diff in asm scripts reload time.

1 Like

Can’t they just give us a toggle that disables certain parts of the scripts assemblies reload process like they did for the domain reload ? Even if it would mean we have to make slight adjustments ourselves.
The compile phase alone takes between 1.5f to 4.9s so there’d be a huge diff between an iteration time of < 5s and one taking 19 to 34 secs.

2 Likes

I would love to be able to control this, and suffer any foot shots I make on myself. I am constantly battling getting stalled for 30-60s because of reloading these script assemblies. It is an absolute productivity killer.

4 Likes

Hey guys, I have got the same problem. When i just create a new script it takes about 2 second for “reloading ScriptAssemblies”. Have somebody solve the problem ?

4 Likes

Same here, after upgrading to 2020.3.35 from 2019 it take about 60s to reload assembly each remark in any script. PIA.

Update: As I almost never shut down PC (using Sleep mode). Seems like Unity collects some “dump”. So restarting Unity helps.

1 Like

Same problem there, restarting unity does not help. The time it takes is absolutely random. The problem pisses off seriously.

4 Likes

Unity, do something with that please! 2021.3.5f1

Same here, sometimes it does not require any script change and the “reload script assemblies” popup show up and freezes Unity for 20~30 seconds, really annoying and inexplicable.

I’m in a relatively small project and experience 30-90 second delays to recompile (e.g. adding one empty line in a class definition). I would expect compilation to be < 5 seconds.

  • 2021.3.61 - 30-90 second delays
  • 2022.1.10.f1 - 30-90 second delays

Anyone have a bug report link on this? I’ll vote it up!

Why tf!! is no one of Unity ever responding to these issues. Paying customers , broken productivity, giving a s* about us ? This whole trouble with assembly reloading etc exists quite a few years now. Thanks unity once more for nothing. Dont listen to what your customers and user say. Rather go ahead and work on some incoherent tech-playground-stuff that will be in alpha for years and deprecated anyways, but at least you have something to hype about. Dont even think about letting me copy and paste components with ctl+c and ctrl+v. f* off unity

12 Likes

There’s an Official post for this issue: Improving iteration time on C# script changes. There are Unity devs who are posting updates to that thread, and responding to questions (although not recently).

1 Like

Yeah I know. I read that thread. tldr is they mainly give a s* in practice. They are working on so much things. But Unity-Engine is a tool being used and payed for to PRODUCE things ( eg create and deliver games ). If they have such a blackhole regarding productivity-time and not focus an essential part of their workforce to work out a fix for this first, then they essentially show their middle fingers to us. I dont use pro but I have spent thousands on the asset store over the years - way more money than for any other software I ever used. As soon as a project gets more mature productivity goes down because of that. So yeah, f* that. The Unity-devs you mention don’t seem to promote the urgencey of this problem. They keep living in their bubble.

3 Likes

Nah it seems to me our voices land on deaf ears atm. They claim an improvement of 8-22% in 2022.2 beta but few others and I have tested it and it’s bs.
I made a bug report & 2 threads ( main one ) and 0 replies nor has it been addressed in releases for more than a month now.
If only they had an internal project like Gigaya and not cancel it years ago we wouldn’t be here discussing about dipping iteration & productivity time.

Mobile microtransaction services are more important now than the company’s flagship product it seems.

5 Likes