登录Google Play游戏服务时游戏崩溃

时间:2017-04-02 08:45:29

标签: android sdk unity5 google-play-games

我正在创造一个统一的2D游戏,但我遇到了一个问题。我已经为谷歌播放创建了一个开发者帐户,并将我的游戏发布到谷歌播放作为封闭的alpha。我现在正在为游戏添加Google Play游戏服务,我从:(https://github.com/playgameservices/play-games-plugin-for-unity)下载了最新的库并将其导入Unity。我已经设置了所有内容,但是在尝试登录时游戏崩溃了。

using UnityEngine;
using GooglePlayGames;
using GooglePlayGames.BasicApi;
using UnityEngine.SocialPlatforms;
using System.Collections;

public class gpgTest : MonoBehaviour {
    void Start () {
        PlayGamesClientConfiguration config = new PlayGamesClientConfiguration.Builder()
        // enables saving game progress.
        .EnableSavedGames()
        // require access to a player's Google+ social graph (usually not needed)
        .RequireGooglePlus()
        .Build();
    PlayGamesPlatform.InitializeInstance(config);
    // recommended for debugging:
    PlayGamesPlatform.DebugLogEnabled = true;
    // Activate the Google Play Games platform
    PlayGamesPlatform.Activate();
}

void Update () {
}

public void LogIn()
{
    Debug.Log("button");
    // authenticate user:
    Social.localUser.Authenticate((bool success) => {
        // handle success or failure
    });
}
}

注意:我已经尝试了几乎所有版本的库和不同版本的Unity 5.0及以上版本。

我也收到这些消息: Unity console

我确实在sdk管理器中安装了所有必要的软件包。

1 个答案:

答案 0 :(得分:0)

好的,对于像我这样苦苦挣扎的所有人,答案是删除版本为10.2.1的所有文件在\ Assets \ Plugins \ Android \中,并将其替换为版本10.0.1。

来源:https://github.com/playgameservices/play-games-plugin-for-unity/issues/1604

简而言之:Play游戏插件与较新的库不兼容。

另一个相关主题:http://answers.unity3d.com/questions/1324988/android-game-crashes-on-startup-becaus-of-google-p.html

编辑:仅支持Unity版本5.0 - 5.5(暂时)