Slow script recompile time

My scripts compile at least 40+ seconds when I make some changes. Which is ridiculous.
Do you have any idea what may cause it?

  • Both Unity and Project are on same SSD drive
  • Using only C#
  • Have less than 5000 lines of code, which is nothing
  • Have i5 (3.4GHz) and 12GB RAM, so speed should be really fast
  • Tried deleting Library and Temp folder from project so it reimports stuff, didn`t help
  • Dont have McAfee, so its scanning cannot slow it down

Please, any idea would be really, really appreciated.

It seems I have fixed the issue.

Not sure what was the cause but:

  • I added Unity and my Project to Avast exceptions
  • I went to Assets menu and Re-imported All

My guess is it was antivirus doing some monkey business there and slowing everything.
Hope this helps somebody in the future.

As far as I know (though I’m sure somebody will turn up and say the exact opposite) it’s recompiling ALL your scripts every time - no incremental compilation.
Anyway, there is a strong correlation between the amount of source you have and the compile time, I hope everybody would agree on this point.

Some claim that taking advantage of compilation order you can basically put stable code in a Plugins folder and it won’t recompile every time. Last time I tested, inconclusive.

A more proven approach is to build DLLs for your stable code.

Having said that, ‘ridiculous’ isn’t the right word. Compilation time largely depends on your hardware, the amount of code you’re compiling, the target platform, the language. Yes, it is recommended to keep compilation times short (seen in textbooks: under 3 minutes). 15 seconds probably falls under the “bear with it” category.