Assembly Definition Files

** Warning **

This update REQUIRES you to delete your <project>/Assets/ootii folder in Unity and download and import the latest version of all my assets that you own.

This is required to support Unity’s Assembly Definition Files.

 

Assembly Definition Files

In Nov, 2017, Unity introduced Assembly Definition Files (ADF). The idea is that if your project is structured a specific way, Unity can cut compile times down 70 to 80%. They do this by grouping code and only recompiling that group if the group itself changed.

In our tests, we saw compile times go from 12 seconds to 3 seconds. This is huge when you think of how many times you go into code while creating your game. In our case, every code change and every re-compile time dropped by 75%.

 

Groups and Folders

To do this, we need to organize our projects based on these groups. In my case, I wanted the following:

ootii – Group for all core ootii asset code that works in the editor and production.

ootii.Editor – Group for all core ootii editor code that works in the editor.

ootii.Demos – Group for all ootii demo code.

 

What this means is that if you don’t make a change to the code in one of these groups, that group won’t need to re-compile if you make a code change somewhere else.

Example:

Let’s assume compiling my code takes 9 seconds and your custom game code takes 2 seconds. Without ADF if you make a change to your code and click on Unity, Unity will take 11 seconds to re-compile. However, with ADF if you make a change to your code, my code doesn’t need to recompile. That means your compile time is 2 seconds.

 

As someone who codes a lot, that’s a big deal.

 

Required Changes

To support all of this, I had to change the ootii folder structure from the left to the right:

As you can see, we created a folder for each of the groups:

ootii –> Assets/ootii/Assets

ootii.Editor –> Assets/ootii/Editor

ootii.Demos –> Assets/ootii/_Demos

As you can imagine, each of my assets now puts the appropriate code into the appropriate ADF folder.

 

The Pain

This doesn’t happen often, but this is an example where you’ll have to delete your ENTIRE Assets/ootii folder before updating the assets. Then, you’ll have to download and import ALL the assets as they all have the new folder structure.

Unfortunately, this is something we can’t avoid.

 

 

 

Page Contents