unity 游戏第一次安装完之后运行,切出来,点击桌面图标后黑屏问题

unity 游戏第一次安装完之后运行,切出来,点击桌面图标后黑屏问题

这个问题只会在第一次出现,之后就是桌面进入了,不会再出现这个问题了

这是一个解决办法吧:

就是将安装之后运行的游戏杀死,然后在重新进入游戏,

 // 在onCreate()最前面添加一下代码

if (!isTaskRoot()) {
    final Intent intent = getIntent();
    final String intentAction = intent.getAction();
    if (intent.hasCategory(Intent.CATEGORY_LAUNCHER) &&
            intentAction != null && intentAction.equals(Intent.ACTION_MAIN)) {
        finish();
    }
}
原文地址:https://www.cnblogs.com/dudu580231/p/7552536.html