In this thread [ 2019.3 slow build times ] I’m looking at long script compile times in my project. To summarize, the top libs are:
Something like Unity.Mathematics I don’t want to recompile every time I make a script change in my project, especially for unrelated code. If I add a line of debug logging, and do a script only compile, I have to wait roughly 7 seconds for Unity.Mathematics to compile despite no changes being made to it.
I know caching different combinations of binaries can be complicated, but I was thinking of making my own system if this isn’t supported by Unity directly. I rather not waste time if it exists though!
Specifically: “Without Assembly Definitions, Unity compiles any C# scripts in your Project into one of the predefined, managed assemblies. Unity must then recompile every script in the entire Project when you change any script. This means that the length of time between making a code change and seeing that change in action grows longer as you add more scripts to the Project.”
As my original post indicates, each one of those listed has their own assembly definition or else they would show up as only Assembly-CSharp.dll. @Shaunyowns
Unity.Mathematics is unity’s own official lib. And it has its own asmdef file. As do all the other packages in the list. So the link doesn’t help unfortunately.
I’ve been informed by Unity support that incremental build support will not arrive until 2021, as part of their “performance and iteration speed” focus.
[mention|aE9ko4037o9jVXrF8OUwUQ==] Unity does recompile stuff that it should never recompile more than once. As long as I have a package referenced, compiled and none of it’s dependency changes there is zero reason to recompile it (edit: okay, there are situations you have to, e.g. change of defines, platform, …) . However, Unity does it definetly in scenarios where nothing has changed that will affect this binary. This also is the case since .asmdef was introduced and I never saw it working correctly. In the beginning it sometimes recompiled the same asmdef multiple times in a row (because it was referenced multiple times -.-), nowadays there seem to be less triggers to cause it to recompile multiple times but it happens and it is a known issue and reported here.
Edit: Just to prove what I am stating here. This pastebin shows my recompilation times. I run into those with every single update. Guess how many dlls I actually change each update - 1 up to 2, as all I am doing is updating “leave” assemblies. For sure I am not updating “Havok.Physics” or any dependency of it. A process that takes me seconds to minutes outside of unity does take me hours within unity. It is ridiculous. On top of that it does a AssetDatabase.Refresh which also takes some time, and I am sure there are other things I am waiting for but do not even watch out for anymore. And this is a tiny project.