Scripts compilation/import extremely slow in 2019.3.xx

Hi,
I hope this wasn’t already addressed but I’ve noticed since moving to the beta that my scripts are taking forever to get compiled/imported when I move from VS back to Unity.

Indeed I have approx. 3,000 C# files in the project, so I’ve tried creating a new folder, with a single C# script and an assembly definition file. It was my understanding that changing/importing this script, being in its own assembly, should have been blazing fast.

However, it still takes more than 10-12 seconds when i change the script and move back to Unity. Sometimes the “import xxxxx.cs” popup appears, something it just hangs with no UI.

Tried both with 2019.3.0f1 and 2019.3.0f5.

Older versions weren’t super fast either, but I think at least 50% faster than the beta.

Any suggestions? I’d be willing to update the project with assembly definition files, but if it takes 12 seconds to compile one script with 10 lines of code in it, seems more a waste of time to me.

Cheers

5 Likes

It’s probably the Domain Reload not the compilation time? When the loading circle thingy in the lower right is rotating the editor is compiling, when it’s hanging the domain reload is happening which involves serializing/deserializing loaded assets, disabling/enabling ExecuteInEditMode stuff and ScriptableObjects and doing a AssetDatabase refresh.
Some AssetDatabase stuff is still slower in 2019.3.

You can attach the profiler, do a recompile and stop the profiler when finished. This gives you a pretty good overview what too the time and maybe you can work around it. ReloadAssembly should be a huge spike.

1 Like

I really can’t profile anything, as soon as I leave from VS 2017 and go back to Unity, the Editor hangs for about 12 seconds, sometimes the “Importing ******.cs” popup appears at the beginning, sometimes it briefly appears just before functionality is restored.
There’s no circle icon, it’s just completely frozen.

Indeed it’s not compile time, if I clear the Scripts cache it takes a second to rebuild it right away, it’s doing some crazy gigantic refresh which is totally useless.

Am I the only one facing this issue?

2 Likes

This issue is already being discussed in this thread if I’m not mistaken.

We’re still missing a reproducible. It would help a lot if you could submit a bug report.

Great, thanks. I just wanted to know it’s something at least being notified by someone and it wasn’t just me, I will follow that thread closely.
Unfortunately it’s a 15 GB project and can’t really make it available. With small projects the problem is not really noticeable.
However it seems to me that by adding assembly definition files there’s no improvement at all while importing the new scripts.

Open the profiler, start it then do a script change and go back to the editor. After it reacts again stop the profiler. There now should be a frame taking alot of seconds.

I really hope something will be done with domain reload. A huge part of my work day is wasted waiting for Unity to “un-hang” itself. There should be at the minimum some kind of progress bar for this process. It can take 10 seconds or more on a relatively small project (several gigs, some packages).

3 Likes

I’d be OK if at least assembly definitions would solve the issue, but I’ve tried one assembly with one script of 5 lines of code, and when I change it it takes the same time as any other assembly change (10-15 seconds).
It’s quite depressing, but let’s hope something will come up soon :slight_smile:

Profile file sent, changed one line of C# in an asmdef’d setup, with a trivial scene of one biped and a bunch of cubes. Case 1213483.

3 Likes

Any progress on this story?

second this…i have 2-5 second lag when return from visual studio…its just small project with dots package, hybrid renderer. my system is quad core i7 1.6Ghz, DDR3 12GB memory, external gpu with GT710 1GB DDR5

I have tested this problem caused by asset pipline v2 which is really a bug feature.


This happened in any project even just new empty with newly installed unity.
versions in unity 2019.2 wont cause this problem because of using asset pline v1.
If you reimport from a 2019.2 project with 2019.3 or 2019.4 and choose keep v1.
The compiling would be quick enough.So this surely was the problem.
But I think unity would never meet this problem as it looks like linked with the system hardware.
Even if you reinstall the system.Save problem still happened.
It is not an occasionally bug but happened on very few machine.So unity would never fix it I think

:rage::rage::rage::rage::rage::rage::rage::rage::rage::rage::rage::rage::rage::rage::rage::rage::rage::rage::rage::rage::rage:
==================previous======================
Unity got serious problems on the save/script instant compile for 2019.3+ (100 percent happen on 2019.4 or 2020)
I am afraid that the promblem maybe linked with the pakcage manager or asset bundle something as 2019.2.7 did not happens.
I have changed IDE from vs to rider.Still got the same problem while saving is maddly slow.
I just create a new project and the bad lag happened. My computer 16GB win10 with RTX2060 cpu:9400f
it must be a unity bug conflict with system.Because very few person seems faced this problem.
With the lag,unity is just jammed and useless but it can not used for work anymore.
Any time you just change a number to test the game would wait like a fool for 3-5 seconds.
Please fix as it is an urgent 1st serious bug I’ve ever meet

2 Likes

Hi, try to update visual studio.

I’m having the same issue. When I open a script the editor hangs and freezes for 10 seconds…

unity, don’t make me regret updating to 2019.3.5. shouldn’t have to deal with 10-15 of bs hanging after a simple script change

I’m having the same issue (my profiler says the bulk of the time is taken by VS Unity bridge – syntaxtree.visualstudio.unity.bridge.projectfilepostprocessor), likely because VS recompiles all the assemblies when I make a tiny change. It’s very unproductive :frowning:

Is there any fix on this ?
PS: I’m using Unity 2019.4.14f1. Are earlier versions prior to 2019.3.x better ?

I am in 2019.4.13f1 and I am getting the same thing. Every little script change I do causes a 10-15 second hang in UNITY.

Having the exact same issue with Unity 2019.4.14. I didn’t have any issues like this using 2019.3, and that was after converting my project to asset database V2. I managed to capture the freeze in the profiler after deleting an empty .txt file that had no impact on scripts:

Same issue, SyntaxTree.VisualStudio.Unity.Bridge etc. is causing 24,000 ms slowdown. When I save a script and try to compile, I get this before the compilation starts:

Seems to be related to V2’s ReloadAssemblies → ReloadAssembly → EndReloadAssembly. The before and after processing invokes each take 35,000 ms. I have no clue why this is happening suddenly, sometimes when I start up this version of Unity it doesn’t happen. I didn’t have any of these issues in previous versions and it’s slowly making this project a nightmare to work on :frowning: any ideas would be appreciated.

Any progress here? @LeonhardP ? Thanks :slight_smile:

This is really affecting my mental health, each small change I have to wait 15-30 secs with unusable editor (I7 7700QK - Nvme SSD - 16gb ram - gtx1070) Unity 2019.4.18 please if anyone fixed this help us

2 Likes