UNITY_EDITOR defines set in Cloud Build

From a full log in an Android build:

522: [Unity] -define:UNITY_EDITOR
523: [Unity] -define:UNITY_EDITOR_64
524: [Unity] -define:UNITY_EDITOR_OSX

These editor defines are set when building in UCB. This can’t be right, can it?

PlayerSettings.applicationIdentifier is incorrect in a cloud build (bundleIdentifier used to work before 5.6) because it’s apparently using the package ID from OSX. Not sure if this is related.

UCB runs the editor to make a build, so those defines are correct (those defines are generated automatically by Unity when launching the editor). If you’re having an issue with applicationIdentifier that should be unrelated - can you PM me a link to your project (and which specific build) so I can investigate?

Well yep, I just checked all the dev and release logs and it is in there.
Is there any situation where UNITY_EDITOR is not defined?

Because documentation says: Define for calling Unity Editor scripts from your game code.

AssetStore libraries got debug and development code within the UNITY_EDITOR define, that is supposed to be called only within the editor (like mouse input for testing touch input, or serialization stuff for the editor).
Does this mean, that this code is compiled for the target platforms anyway?

And if yes: What is the point of using this define at all, if the game code calls editor scripts anyway?
(A post where this solution came up by one of your guys: #if UNITY_EDITOR && !UNITY_CLOUD_BUILD )
And if no: Where do I see the defines in UCB, that are really applied for compilation?

Edit: Using #if UNITY_EDITOR && !UNITY_CLOUD_BUILD solved the broken UCB build. So if this code got included, the overhead code from the libraries gets included as well. oh dear…

1 Like

Hello,
Can someone confirm what MoxInnovations wrote?
Do we need to use #if UNITY_EDITOR && !UNITY_CLOUD_BUILD anytime we want block of code only when executed in Editor?
Regards,
Marcin Żmijewski.

1 Like