In Unity, each time you make any change to your C# code the entire project is recompiled. This can take anywhere from a couple of seconds to minutes, depending on your computer’s hardware, the size of your project and number of plugins.

Thankfully, a new feature was released yesterday in Unity 2017.3 which allows you to selectively recompile certain files, instead of the entire project. This can greatly speed up your development time, as you typically do not change code in your 3rd-party plugins.

Read on for a quickstart guide on how to get this working for you.

Assembly Definitions: Quickstart

I followed the same layout which was provided by Unity in a sample project one of their devs they linked to. I’m unable to find that same sample project at the moment, but the general layout looked something like this:

Assets/AssetsRoot-ASM.asmdef (References: Plugins-ASM.asmdef)

Assets/Plugins/Plugins-ASM.asmdef (No References)

Assets/Plugins/PostProcessing/Editor/PostProcessingEditor-ASM.asmdef (References: Plugins-ASM.asmdef) and (Includes: "Editor"-only!)

Assets/Scripts/ScriptsASM.asmdef (No References)

In Unity 2017.3, you can create a new type of file called “Assembly Defintion” the same way you would create a sphere, cube, script, shader, etc. (using the “Create” menu). Place each of these Assembly Definition files in the directories you want to control using Assemblies.

For the tiny project I’m currently working on, I was able to shave a couple of seconds off (from 8 seconds to 5.5 seconds) by avoiding recompilation of the 4 plugins I’m using when I change my scripts. I haven’t tested this on one of the larger projects I’ve worked on yet, but I’m excited to see how much of a difference it makes.

Download Unity 2017.3 Here: https://unity3d.com/get-unity/download

Documentation: https://docs.unity3d.com/2017.3/Documentation/Manual/ScriptCompilationAssemblyDefinitionFiles.html

Unity's Blog Post: https://blogs.unity3d.com/2017/11/22/unity-2017-3b-feature-preview-assembly-definition-files-and-transform-tool/

Compile Time Script on Gist: https://gist.github.com/chuckbergeron/245e0f5906c89f7d01c02eeb052e1b04

Happy performant game developing!

😄