Search Unity

Deployment on Android Emulator - Different Questions

Discussion in 'Prefabs' started by Kaffibecher, Sep 3, 2019.

  1. Kaffibecher

    Kaffibecher

    Joined:
    Dec 31, 2017
    Posts:
    15
    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
     
  2. Baste

    Baste

    Joined:
    Jan 24, 2013
    Posts:
    4,214
    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.
     
  3. Kaffibecher

    Kaffibecher

    Joined:
    Dec 31, 2017
    Posts:
    15
    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.
     
  4. Kaffibecher

    Kaffibecher

    Joined:
    Dec 31, 2017
    Posts:
    15
    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.

    Removed.PNG

    Removed-Script.PNG

    Removed-Script-Debug.PNG

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

    Best regards
    K
     
    Last edited: Sep 7, 2019
  5. Baste

    Baste

    Joined:
    Jan 24, 2013
    Posts:
    4,214
    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.
     
    Kaffibecher likes this.
  6. Kaffibecher

    Kaffibecher

    Joined:
    Dec 31, 2017
    Posts:
    15
    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.