Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Add UNITY_EDITOR preprocessor directives to editor scripts #479

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

silasalves
Copy link

@silasalves silasalves commented Feb 15, 2025

The portions of code with Editor code were being compiled into the Android APK, which caused compilation errors.

I deactivated that portion of the code using the preprocessor directive #if UNITY_EDITOR.

I also replaced two deprecation warnings in com.siemens.ros-sharp/Editor/RosBridgeClient/RosConnectorEditor.cs.

This fixes #478. It may be related to #475, which seems to offer a simpler solution.

@StepanStulov
Copy link

This is due to the misconfiguration of the assembly definition at the com.siemens.ros-sharp/Editor/siemens.ros-sharp.Editor.asmdef file. It's marked as Any Platform instead of being Editor (see picture).

Note, that it's not conventional to surround Editor-only (the ones having ../Editor/.. in their path) scripts with the #if UNITY_EDITOR pre-processor directives. That directive is for injecting fragments of Editor code into Runtime code. It is not for Editor-only scripts. Please do not use this solution and fix the assembly definition file instead. That's the "Unity way".

Image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Cannot build for Android in Unity 6
2 participants