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 … mUnityPlayer.quit() sucks
I had the same problem. The MainActivity was always restartet after calling mUnityPlayer.quit();
I found the solution here:
I’m working on an app that combines eclipse and unity. The use can switch activity to an activity that contains an instance of a UnityPlayer, displaying inside a view. When i switch from this activity to another activity, mUnityPlayer.quit() is...
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:
In some scenario developers using native platform technologies (like Android/Java & iOS/Objective C) want to include in their apps/games features powered by Unity (usually for 3D/2D Real Time Rendering), like AR experience, interaction with 3D models, 2D mini games and more.
Starting with Unity 2019.3.a2, we are introducing a new feature to use Unity as a library in native apps by integrating the Unity runtime components and your content in a native platform project. The Unity Runtime Library …
This document explains how to include Unity as a Library into standard Android application through Activity. You can read more about Unity as a Library.
This example address Version 1 issues of example, most important one relates to unloading/quitting Unity.
Pre Requirements:
Android Studio 3.4.2+
Unity version 2019.3.0b4+
1. Get source
Clone or Download GitHub repo uaal-example . It includes:
[4584565--427066--image8.png]
Unityproject - this is a simple demo project made with Unity…