- Home /
How do you find out what scripts are making your compile time slow?
If your scripts are still slow even after compiling separately via asmdef files, then the problem is with the domain reload, per here: https://forum.unity.com/threads/example-project-assembly-definition-files.482313/page-6#post-3314226
Answer by x4000 · Dec 07, 2017 at 04:12 PM
I actually just posted this question because someone from Unity already answered it, and I felt like the answer needed more visibility: https://forum.unity.com/threads/example-project-assembly-definition-files.482313/page-3#post-3292894
.
From his post:
.
"Check your Editor.log for messages on how long individual assemblies took to compile and how many assemblies are recompiled on changes due to dependencies."
.
And then:
.
Editor freeze is because we reload all the assemblies. Typically we see long reload times when users have lots of code in InitializeOnLoad, Awake and other methods called during the reload. Figuring out what script code is causing the delay today is somewhat tricky, but we are working on a better solution.
.
The way to find script code that can cause long reload times today:
1) Open the Profiler, enable deep profiling and profiling in the editor.
2) Keep the profiler window visible, because you will need to "quickly" disable editor profiling.
3) Enter play mode
4) Once enter play mode is finished, exit play mode and disable editor profiling.
5) Find the frame that takes a long time to complete and then find scripts that run for a long time.
.
And then he provides a visual example.
In Unity 2019.2.0f1 having the Package $$anonymous$$anager tab open (even if it’s not showing) increases my Domain Reload time (both for compile and run) by FIVE ENTIRE SECONDS!!!!! Just closing the “Packages” tab cut my compile/domain reload times in half!!!!!!!!!
Answer by Bryan-Legend · Oct 30, 2019 at 09:33 AM
In Unity 2019.2.0f1 having the Package Manager tab open (even if it’s not showing) increases my Domain Reload time (both for compile and run) by FIVE ENTIRE SECONDS!!!!! Just closing the “Packages” tab cut my compile/domain reload times in half!!!!!!!!!
Close any tabs you don't need and measure using Compile Time Tracker (https://github.com/DarrenTsung/DTCompileTimeTracker)
Same here. I'm glad I found this answer. Thank you.