Deployment on Android Emulator - Different Questions

Hi!

I currently developing a game, which should run on Android, based on Unity 2018 LTS. After deploying the game on the android emulator. It is mentioned in the logs that some Game Objects in the scene were not found or probably deleted by Unity itself.

I already experienced that sometimes in the Unity Editor, but for me as a Developer it’s seems it is a strange behavior, that it sometimes deletes Game Objects in the scene,which were configured in the Editor scene. Is this normal in Unity? How can I avoid that? How can I debug that on the Android device/emulator?

My second questions is, how can I debug the game scripts and scene state on android from the Rider IDE? I was following the visual code Tutorial on the Unity documentation page, but I was not successful to do that also with Rider.

Thank you for your advice in advance.

Regards
K

GameObjects can be deleted on build, either because some script with OnPostProcessScene is doing that, or because the GameObject is tagged with the “EditorOnly” tag.

Unity doesn’t arbitrarily delete GameObjects, though, so it’s something you (or some third-party library you included) did.

When you say “It is mentioned in the logs”, what do you mean? What are the exact log entries?

I don’t develop on mobile, so I have no clue about debugging on device, sorry.

Dear Baste

Thank you for answering my question. I am currently on vacation, therefore, I cannot upload screenshots. The error message was MissingComponentException. It was probably a Property Parameter for a Script in the scene was removed during the build process somehow, but I do not know how to validate that how to solve that problem. The log which I was mentioned, is the Android logcat log which is forwarded to the Unity Editor.

Hello again

I made some more tests. I was not able to remote debug with the Android Emulator therefore I have moved to my Android phone, were I was able to connect.

After debugging the code, I saw that Unity has removed the scene objects added as a field in the script as you can see in the screenshots attached. The other game objects seems to be ok.

4941773--479666--Removed.PNG

Is this a normal behavior? How can I avoid that?

Best regards
K

The Scene asset type lives in UnityEditor, and is not available at runtime. You have to either use a string, or build a wrapper.

What does those scene fields look like in code? I’m surprised it even compiles.

1 Like

Dear Baste

Thank you very much for the tip. I will try that out asap.

I was using the UnityEngine.Object type as field type.