Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Asmdefs in Packages with Subfolders

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

  1. YolanOTHER

    YolanOTHER

    Joined:
    Oct 23, 2016
    Posts:
    47
    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:
    7,888
    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:
    47
    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.