How to improve compilation time?

What is the best practice for improving compile time in a relatively large project with over 2000 scripts?

using less lines and less spaces

1 Like

Put any code that rarely changes into the Plugins folder. Any third-party asset should be inside of Plugins, unless you’re making local edits to it on a frequent basis.

Then, check out Unity Script Compilation - IO analyis - Editor.log does two IO calls per byte written - Unity Engine - Unity Discussions, which suggests that communicating with Visual Studio and writing to log files can also be costly.

3 Likes

Get an SSD.

This post right here is really old, but the advice is still good. The most important points are:

  • UnityScript (and boo!) is much slower to compile than C#.
  • It’s faster to not compile code than to compile it! Code in a .dll won’t get recompiled. Code in plugins won’t get recompiled unless you change other code in plugins. If you can take big chunks of your project and extract it into a .dll, that’ll help a lot.
4 Likes

That will improve compile time marginally, if at all. The compiler could care less about how many lines and spaces there are…removing them is one of the first steps, and it’s probably one of the cheapest operations involved in the whole process.

2 Likes