Search Unity

AssemblyDefinitionFiles: good idea but not usable in praxis

Discussion in 'General Discussion' started by Hosnkobf, Jul 2, 2018.

  1. Hosnkobf

    Hosnkobf

    Joined:
    Aug 23, 2016
    Posts:
    1,096
    I just upgraded my project to Unity 2018.1.6 (from Unity 2017.1.1) and had some issues with scripts working with assemblies... After research I could solve most of the problems. However, I stumbled upon these AssemblyDefinitionFiles.

    I have some scripts made myself which divides my code into different csproj files on compilation time (with help of VS Tools for Unity). After the unity update it produces empty projects or an empty solution sometimes... But I thought that I actually could replace my scripts with the AssemblyDefinitionFiles.

    However, I realized that I have to create these .asmdef files in every Editor folder... I searched the project: I have 20 of them.
    Why is there not just a checkbox somewhere "Tread Editor folders as own assembly" or something like this?

    You could ask: why not doing it once and put in every Editor folder your asmdef file?
    Besides the fact that the solution would explode, it also has the problem that these files would probably be deleted when updating an asset-store-asset where I previously have put an asmdef file.

    And now look from the Asset developer perspective: I already have found a post from one who tells that the asmdef files are already included in the new version of his asset. But since you should use asmdef files everywhere OR not at all, this will break a lot of projects (those, which do not use it at all).

    Conclusion: I was looking for this feature for a long time and even built something myself to work with a proper project structure. Unfortunately, Unity developers didn't thought it through well enough.

    My wish:
    Please make it possible to put the asmdef files at any location in the project and let the user define one or more folders which should be included in the certain assembly. This way it is easily possible to make shared projects for all the third party code and all the third party editor code and at the same time it won't break when updating an asset.
    Also it would be nice to automatically detect Editor folders and put them into another assembly (if the case of the user desires it).

    The implementation right now is a pain.
    I would be happy if somebody from the unity team could add some thoughts.
     
    mitaywalle and Deleted User like this.
  2. CharlesWard

    CharlesWard

    Unity Technologies

    Joined:
    Apr 19, 2017
    Posts:
    19
    In case, anyone happens upon this post, you can now create Assembly Reference assets to include scripts in a folder in an assembly defined with an Assembly Definition asset in another folder. For example, you could have one Assembly Definition asset for your Editor code, and use Assembly References in all the other Editor folders containing scripts you want to include in that assembly.
     
    fnnbrr, owlrazum, Marks4 and 2 others like this.