Introduction
Cobra Assemblies is a tool designed to optimize the performance of your Unity project. It enables the generation of assembly definition files with ease, significantly organizing and compartmentalizing your code and assets into focused assemblies.
What is an Assembly Definition File?
An assembly definition file is crucial for Unity project performance. It is a file that groups scripts and assets to be compiled into a single assembly. By organizing into smaller assemblies, your project's load and compile times are reduced, which is vital for large and complex projects.
The Challenge of Manual Assembly Definition
It is important to note that not all asset developers utilize assembly definitions, potentially slowing down compilation. Moreover, Unity's requirement to recompile everything upon any change in an assembly definition adds to the complexity and time consumption of manual creation.
Using Cobra Assemblies
To use Cobra Assemblies:
- Open the editor window:
Tools -> Byte Cobra -> Assemblies
. - (Optional) Add directories to exclude.
- Click the "Create Assemblies" button.
The tool generates assembly definition files for all directories within the assets folder, excluding any specified directories. This process allows for compartmentalization without the need to recompile the entire project for each change.
Generating Assemblies for Specific Folders
- Open the Project context menu (right-click on any folder).
- Select
Byte Cobra -> Assemblies -> Create Module
.
This feature facilitates a semi-automatic workflow, enabling selective optimization of project areas without manual assembly creation.
Restoring Assemblies
This tool additionally offers functionality for cleaning up the generated assemblies. This means you can easily revert your project to its original state, ensuring a smooth and flexible workflow. You can do this either from the context menu or the tools menu.