Android - embedding Unity3d scene in activity - need to unregister receiver?

后端 未结 1 1274
春和景丽
春和景丽 2021-01-02 11:02

I\'ve been a SO member for a while but never actually asked a question, so here goes..

My Aim

I\'m trying to make an Android app with two activities. The f

相关标签:
1条回答
  • 2021-01-02 11:21

    So, I did some more searching and eventually found an answer, right here on SO!

    As discussed in this answer, adding this line to the manifest fixes the problem;

    android:process=":UnityKillsMe"
    

    so the relevant part of the manifest looks like this;

    ...
    
    <application
        android:allowBackup="true"
        android:icon="@drawable/ic_launcher"
        android:label="@string/app_name"
        android:theme="@style/AppTheme" >
    
        <activity
            android:name=".Studio"
            android:configChanges="orientation|keyboardHidden|screenSize"
            android:process=":UnityKillsMe"
            android:label="@string/title_activity_home" > 
        </activity>
    
    ...
    

    This forces the gameplay activity to launch in a separate process. This means you can call m_UnityPlayer.quit() in the activity's onDestroy method without the whole app closing.

    Simple fix, but annoying that it seems to be completely undocumented.

    Hope this helps someone!

    0 讨论(0)
提交回复
热议问题