Search Unity

Resolved Should I also combine ASMDEF files?

Discussion in 'Editor & General Support' started by mfatihbarut, Oct 18, 2021.

  1. mfatihbarut

    mfatihbarut

    Joined:
    Apr 11, 2018
    Posts:
    1,060
    Hi all,
    Lets say I have 20 assets and each of them has editor and normal scripts.
    I separated their scripts into 2 folders each and prepared 20 normal ASMDEF files for each folder and 20 ASMDEF files for each editor folder.
    Should I also put every normal folder into 1 main folder and prepare 1 ASMDEF file in it? And do the same for editor folders?
     
  2. In general you should use as few asmdef files as possible. If it is possible I would separate the non-editor files and think about how they will change if they won't often, then put them into one asmdef. If there is a separation possible, put the ones referencing the others into one and the referenced into another. Do the same with the editor stuff separately. Obviously you will need to maintain the references between these asmdefs.
     
  3. mfatihbarut

    mfatihbarut

    Joined:
    Apr 11, 2018
    Posts:
    1,060
    So would this be the best approach?
    1- Make 2 folders ExternalRuntime and ExternalEditor
    2- Put all 20 asset folders in ExternalRuntime
    3- Then Cut all the editor scripts from 20 assets and put them in the ExternalEditor folder
    4- Prepare 2 ASMDEF files one for runtime one for editor folder (be sure to check only editor for editor ASMDEFs)
    And they are done
    Except mines
    Then
    - Create 2 folders for my scripts "Done" and "Working"
    - Create ASMDEF file for "Done" folder and
    when ever I work with a script put that script in the working folder
    and ofcourse complete the references between ASMDEF files if needed
     
    Last edited: Oct 18, 2021
  4. This is pretty much what I'm doing. Just be prepared that sometimes you need to move things around to avoid circular references and dependencies. The important thing is that keep as few as possible (because the more you have the more have to be checked against change during compile).
     
  5. mfatihbarut

    mfatihbarut

    Joined:
    Apr 11, 2018
    Posts:
    1,060
  6. mfatihbarut

    mfatihbarut

    Joined:
    Apr 11, 2018
    Posts:
    1,060
    Another question instead of wasting time why I don't put every external folder into plugins folder and stop compiling them?
     
  7. mfatihbarut

    mfatihbarut

    Joined:
    Apr 11, 2018
    Posts:
    1,060
    After closing and opening Unity again
    Of my God! from 70 seconds to 20 seconds compile time really really great!
     
  8. mfatihbarut

    mfatihbarut

    Joined:
    Apr 11, 2018
    Posts:
    1,060
    Something bad happened. I can't get rid of circular references. both of my scripts should reference each other what should I do in that case?