Search Unity

Restarting UnityPlayer inside of Android activity

Discussion in 'Android' started by Jessespike, Aug 29, 2012.

  1. Jessespike

    Jessespike

    Joined:
    Jul 9, 2012
    Posts:
    44
    I been trying my best to minimize a random hanging on scene loads. I have followed the mobile optimization page and have reduced memory significantly. But after a few scene loads, Unity will still hang. Logcat spams "Inflate error: ...". (Heap overflow?) Basically from here, Unity gets stuck loading the next scene until after a few minutes or so, then the activity gets timed out / dropped.

    I been trying to handle the hanging, normally a scene takes less than 10 seconds to load. If the load gets stuck and persists for 30 seconds, I instruct Unity to call it's android activity. Which I am able to do, and currently I am simply instructing UnityPlayer and the activity to shutdown. But that's not what I want to do, I want to restart the UnityPlayer in the activity without actually re-launching the app from the OS.

    I don't have much Android experience, but I do realize that traditionally in Android applications, the developer is expected to handle gl-context recreations and such, (reloading textures etc). But UnityPlayer seems to work differently. Mind you, this problem only exists in Android 2.3.x, if I use Android 4.x, everything is OK.

    I'm currently experimenting with onSaveInstanceState and other activity methods, but I haven't had much luck yet.



    TLDR;
    Unity sometimes hangs while loading a scene, I can call activity methods from Unity. I want the activity to recreate the UnityPlayer. I want UnityPlayer to restart without the need to actually quit the activity and re-launching from the OS.
     
  2. netlander

    netlander

    Joined:
    Nov 22, 2011
    Posts:
    28
    Have you solved this particular problem?
     
  3. GemmaLamont

    GemmaLamont

    Joined:
    Oct 9, 2018
    Posts:
    8
    Was this ever solved?