【问题标题】:Unity with Google Play Plugin Application Freeze On Quit Application On AndroidUnity with Google Play Plugin Application Freeze On Quit Android 上的应用程序
【发布时间】:2015-03-17 21:08:52
【问题描述】:

我正在使用带有 Google Admob 插件和 google play services 插件的 unity 4.6.1(最新版本)(我现在只使用插件的登录/注销功能)。

问题如下。当我在 android 上运行我的游戏并播放返回按钮时,游戏冻结了大约 10 秒然后退出。但是,当我禁用登录/注销时,它会按原样退出。论坛上的一些人谈论 Admob 来解决这个问题,但 Admob 到目前为止非常好,似乎并没有导致这个问题。该问题似乎是由登录/注销引起的。有什么帮助吗?

编辑:当您从未登录游戏时,不会出现冻结问题。但是,一旦您登录然后退出,它会在退出时冻结..

【问题讨论】:

标签: unity3d admob google-play-services unityscript google-play-games


【解决方案1】:

作为临时解决方法,我将以下内容放入我的单例中:

public static void RealApplicationQuit()
{
    #if UNITY_ANDROID
    ((GooglePlayGames.PlayGamesPlatform) Social.Active).SignOut();
    AndroidJavaClass jc = new AndroidJavaClass("com.unity3d.player.UnityPlayer"); 
    AndroidJavaObject activity = jc.GetStatic<AndroidJavaObject>("currentActivity"); 
    activity.Call<bool>("moveTaskToBack" , true);
    #endif
    Application.Quit();
}

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-07-16
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多