zoukankan      html  css  js  c++  java
  • Unity结合android backpress造成的问题

    今天在制作unity和android混合APP的时候,遇到个闹心的问题,custom unityactivity在finish并返回前一个android native activity的时候,总是自动返回桌面home screen。

    经过百般查询,看到有帖子说unityplay.quit()方法造成,估计是自动结束了当前的player进程。

    步骤估计是ondestory->unityplayer.quit->kill process

    那么问题来了,如何解决这个自杀进程造成的APP自动退出?

    答案就是在manifest的unity activity添加process,让其自己另开进程运行,这样就不会进程关闭导致APP close的问题了。

    如下:

    <activity 
        android:name="com.package.example.UnityActivity" 
        android:label="@string/title_activity_unity" 
        android:screenOrientation="portrait" 
        android:launchMode="singleTask" 
        android:process=":UnityJustKillYourself"
        android:parentActivityName="com.package.example.MainActivity"
        android:configChanges="mcc|mnc|locale|touchscreen|keyboard|keyboardHidden|navigation|orientation|screenLayout|uiMode|screenSize|smallestScreenSize|fontScale">
        <meta-data android:name="unityplayer.UnityActivity" android:value="true" />
        <meta-data android:name="unityplayer.ForwardNativeEventsToDalvik" android:value="false" />
    </activity>
    

      

  • 相关阅读:
    浅谈flume
    浅谈storm
    浅谈zookeeper
    IntelliJ IDEA 使用教程
    浅谈spark
    添加本地jar包到maven仓库
    eclipse通过maven进行打编译
    pom.xml中添加远程仓库
    maven编译错误maven-assembly-plugin:2.2-beta-5:assembly (default-cli) on project
    最长上升子序列
  • 原文地址:https://www.cnblogs.com/bluelife/p/4062771.html
Copyright © 2011-2022 走看看