Calling mUnityPlayer.quit() closes entire Application, unwanted

Currently i have an application that has multiple activities associated with it which must be switched around frequently.

I have a fragment containing an instance of a unityplayer which will run the game segment of the application.

When i switch activities, this is called:

	public void onDestroy() {
		super.onDestroy();
		mUnityPlayer.quit();
	}

However running mUnityPlayer.quit(); closes the entire application and not just the activity.

Is there some way to avoid this?

I have the same problem… First i had to track what is killing my service :slight_smile: … mUnityPlayer.quit() sucks

I had the same problem. The MainActivity was always restartet after calling mUnityPlayer.quit();

I found the solution here:

copied answer:
You can stop this behavior by specifying a different process name (f.i. “:unity”) for the UnityPlayerActivity in the Android Manifest. It seems UnityPlayer kills its process when quit() is called so you just have to be sure your Application and other Activities have a different process name (by default it’s the Application package name).

See <aktywność>  |  Android Developers for more info.

Application.Unload() is now the way to quit the Unity Player: Unity - Scripting API: Application.Unload

Note: Only supported on Android and Windows Store.

might be worth to look at: