Search Unity

How to use Assembly Definition Files (2017.3)?

Discussion in 'Editor & General Support' started by Saucyminator, Dec 19, 2017.

  1. Saucyminator

    Saucyminator

    Joined:
    Nov 23, 2015
    Posts:
    61
    Hi! I'm trying to make use of Assembly Definition Files that's been added to 2017.3.

    How do I use it? I'm a bit confused by the release notes. I need some more guidance.

    Is my current setup correct?:

    /Assets/Main.asmdef
    /Assets/Scripts/Scripts.asmdef (references Main.asmdef)
    /Assets/Plugins/Plugins.asmdef (references Main.asmdef)

    I have a few scripts in my /Assets/Scripts folder split up into their own separate folders. Do I need a single .asmdef in each and every folder (that then references Scripts.asmdef)?

    Or is it the other way around?:

    /Assets/Main.asmdef (references both Scripts.asmdef and Plugins.asmdef)
    /Assets/Scripts/Scripts.asmdef
    /Assets/Plugins/Plugins.asmdef
     
  2. Flavelius

    Flavelius

    Joined:
    Jul 8, 2012
    Posts:
    945
    After playing around a bit, i can say that you can think of them as just a way to define different project files in your game-solution (vs/monodevelop) with the referencing definitions inserted as project references. You can't have cyclic references and the main project/definition should depend on its referenced ones.
     
  3. Saucyminator

    Saucyminator

    Joined:
    Nov 23, 2015
    Posts:
    61
    I still don't follow. Anyone got a clearer example?
     
  4. BlackPete

    BlackPete

    Joined:
    Nov 16, 2016
    Posts:
    970
    Peter77 likes this.
  5. Flavelius

    Flavelius

    Joined:
    Jul 8, 2012
    Posts:
    945
    I currently have a project set up with those and i only placed definitions in some plugin folders, so these get compiled into different dlls. And as they don't have dependencies on my code it works without manually assigning references. From what the entry post describes, it should be the same for you.
     
  6. Peter77

    Peter77

    QA Jesus

    Joined:
    Jun 12, 2013
    Posts:
    6,618