Search Unity

  1. Looking for a job or to hire someone for a project? Check out the re-opened job forums.
    Dismiss Notice
  2. Unity 2020 LTS & Unity 2021.1 have been released.
    Dismiss Notice
  3. Good news ✨ We have more Unite Now videos available for you to watch on-demand! Come check them out and ask our experts any questions!
    Dismiss Notice

Asmdefs in Packages with Subfolders

Discussion in 'Scripting' started by YolanOTHER, Feb 2, 2021.

  1. YolanOTHER

    YolanOTHER

    Joined:
    Oct 23, 2016
    Posts:
    46
    I'm trying to create a new disk loaded package for the package manager. I would like to create a single asmdef at the root of the package that encompasses all of the scripts within that package (there are no editor scripts yet, only runtime). From what I've read (and seen with other projects) this should work. On this particular project though, scripts that reference scripts in another directory cannot reference each other. So far the only fix I've found is to create an asmdef for each subdir and manually set up the references between those asmdefs. What could I be missing? I've tried on 2019.4.12 and 2019.4.19.
     
  2. PraetorBlue

    PraetorBlue

    Joined:
    Dec 13, 2012
    Posts:
    5,478
    The setup you're describing with a single asmdef is working fine for me.

    My layout is:
    Assets
    Scripts
    asmdef file
    script 1
    script 2
    ...
    script folder 1
    more scripts
    script folder 2
    more scripts


    Are you sure you're not just forgetting using statements for namespaces or something?
     
  3. YolanOTHER

    YolanOTHER

    Joined:
    Oct 23, 2016
    Posts:
    46
    All of the using statements are properly defined and the code builds without an asmdef if I import it into the Assets directory. One difference I have is I don't have any scripts at the root with the asmdef file. I've done the above with a much more complicated project than this and it works fine which is why I'm confused.
     
unityunity