- Home /
Asmdef and custom conditional compilation symbols
Hello,
I am currently migrating a large codebase that we use for more than a single unity project to assembly definitions and UPM.
Before this change, the project's code used to be compiled outside of unity and the compiled dlls were copied in the assets directory of the unity project. This worked well, but with recent versions of unity, it became difficult to reference unity assemblies and make the project build for a particular version of unity. With assembly definitions and UPM we are able to reuse the same code and target different unity versions with ease.
However, I am missing something which I had better control over when we were compiling our own dlls. We used to define custom conditional compilation symbols, which were global for a given project because we stored them in the respective .csproj file. We could also define these symbols conditionally using the MSBuild syntax. As we moved to asmdef, the .csproj file is no-longer maintained by us, but is being auto-generated by Unity. If we define our custom symbols there, they will be removed as Unity re-generates the csproj files.
My question is -- is it possible to define custom compilation symbols for asmdef projects in unity?