I’ve read this old thread but I didn’t want to resurrect it.
I have some packages that make use of #if/#else
. E.g. I have logging functionalities that can be disabled for release builds. Right now the suggested way to have optional features is to gather and separate the code in an asmdef with a define constraint. Unity - Manual: Assembly Definitions This would make things very ugly and unmaintainable.
In order to keep my code working I can make use of the Version Defines feature. The only way I have to define something in a package is via another package being installed. Unity - Manual: Assembly definitions . I can create empty packages that other packages use to trigger defines. This is very hacky and dirty, and makes the defines management ugly for the devs. Also controlling the defines via code would mean to install/uninstall packages, and it’s slow.
Also, having multiple assemblies makes impossible to have partial classes split between them.
Would be possible to gain access to the defines for the packages? I think the best solution would be to write in the asmdef which are the defines used by the assembly, so that it can be not recompiled on random defines changes.