Platform scripting symbols not working with a custom package

I have created a bunch of custom packages and I import them from a self hosted UPM-esqe registry.

I have some editor code in those packages that will naturally cause a Win64 executable build to fail.

So I have encapsulated the editor code in #if UNITY_EDITOR / #endif

I’ve tested my code without the package and it works fine

However, when I import the code as a package, the #if UNITY_EDITOR doesn’t have UNITY_EDITOR set on my package code compilation stage and my editor tools are consequently missing.

Any idea how this can be fixed?

Thanks in advance

Hey guys,

I’ve figured out how to fix my issue. Just had to set the ASMDEF for the editor scripts in my package to be Editor only and not any platform. Then I didn’t need to do the #if as well and it works!

Hope this helps anyone with the same question