Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice

Adding Assembly References to large existing project

Discussion in 'Editor & General Support' started by Veazed95, May 17, 2022.

  1. Veazed95

    Veazed95

    Joined:
    Feb 8, 2022
    Posts:
    2
    Hi,

    Compilation times for the project I belong to takes a really long time and I wanted to solve that using Assembly Definitions, but it seems that for every Assembly Definition I add, I need to add even more Assembly Definitions for every other dependency that exists in the .asmdef I created.

    My question is: If I plan on using Assembly Definitions, do I have to create an Assembly Definition for everything in my project? Can't I just create a single Assembly Definition for a specific folder which contains C# scripts and have those scripts compile separately from the rest of the project?
    When I created my first .asmdef I had dependency compilation error so I created another .asmdef for the missing dependencies but ran into even more dependency compilation errors with no end in sight.

    Thanks for the help!
     
    tgrotte likes this.
  2. spiney199

    spiney199

    Joined:
    Feb 11, 2021
    Posts:
    6,015
    Generally when using assembly definitions your projects needs to be set up with those in mind. I've gone through the pain of re-factoring a medium sized project to be compatible with assembly definitions, and it takes... quite a while.

    It's hard to answer this without knowing the structure of your project. Mine is roughly structured like this:

    -Plugins Folder
    -MyCompanyName <- Assembly
    -MyCompanyName-Editor <- Editor Assembly
    -MyGameName <- Assembly for each mechanic/system
    -MyGameName-Editor <- Editor Assembly for above assembly

    Then you have your packages folder as well. You just need to be sure that when you make your own assemblies you need to point them towards the assemblies used by any packages or plugins.
     
    Veazed95 likes this.
  3. Veazed95

    Veazed95

    Joined:
    Feb 8, 2022
    Posts:
    2
    That was my guess.. My project's structure is quite large, with many different folders that seem to be dependent on each other sometimes, and creating Assembly Definitions in those folders causes very long compilation times.