Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to keep Android app running and quit Unity Activity

I'm developing an app that integrates with Unity3d, in some part of my code I call an UnityPlayerActivity that starts the Unity3d code. When user finishes using the Unity3d he press a button and go back to Android code. My problem is when I go back to android code, after UnityPlayerActivity calls:

@Override protected void onDestroy ()
{
    mUnityPlayer.quit();
    super.onDestroy();
}

The application is closed, not only the Unity Activity. I could not call this method, but I think that would be wasting memory.

Is there any way I could quit only Unity3d activity and keep my application running normally so I could start Unity3d part again another time?

Tks

like image 276
user2494863 Avatar asked Feb 08 '23 05:02

user2494863


1 Answers

Found an answer. Just need to use another process on manifest.

Basically means, you have to explicitly name your Activity process in your AndroidManifest.xml.

For instance.

<activity
   android:name=".UnityPreviewActivity"
   android:process=".UnityPreviewActivity" />

Reference

http://answers.unity3d.com/questions/587979/how-do-i-stop-munityplayerquit-closing-the-entire.html

like image 187
user2494863 Avatar answered Feb 15 '23 09:02

user2494863