Unity Google Play 游戏插件 - Sign in/Authentication 不工作

Unity Google Play Games plugin - Sign in/Authentication not working

我尝试了所有方法,但现在我已经被这个问题困扰了好几天。无论我尝试什么,Google Play 的登录屏幕都会在应用程序中打开,但随后突然停止并且用户未登录。

在分享代码之前,我先总结一下我所做的事情:

希望有人能帮助我。我再也无法在互联网上找到任何东西,而且我自己似乎也无法弄清楚这一点。这是唯一阻止我们发布第一款游戏的因素。

这是我用于测试应用程序的所有代码。我在场景中添加了一个按钮来登录 GPG 和 1 个文本字段来显示状态字符串。

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using GooglePlayGames;
using GooglePlayGames.BasicApi;
using GooglePlayGames.BasicApi.SavedGame;
using UnityEngine.UI;

public class ClickManagerScript : MonoBehaviour
{

    public GameObject textField;

    public void LogInClick()
    {
        PlayGamesClientConfiguration config = new PlayGamesClientConfiguration.Builder()
            .EnableSavedGames().Build();
        PlayGamesPlatform.DebugLogEnabled = true;
        PlayGamesPlatform.InitializeInstance(config);
        PlayGamesPlatform.Activate();

        SignIn();
    }

    void SignIn()
    {
        //when authentication process is done (successfuly or not), we load cloud data
        Debug.Log("Going to log in to GPG");
        Social.localUser.Authenticate(success => { UpdateTextField(); });
    }

    void UpdateTextField()
    {
        Text text = textField.GetComponent<Text>();

        if (Social.localUser.authenticated)
        {
            text.text = "Sign in succesfull";
        }
        else
        {
            text.text = "Sign in failed";
        }
    }
}

对于看到这个 post 并遇到同样问题的人:在您的代码中禁用已保存的游戏,然后登录就可以了。云保存现在坏了。下面 link 上的最新评论就是关于这个问题的。希望Google尽快修复它,云保存对于保存 IAP 购买等非常方便

https://github.com/playgameservices/play-games-plugin-for-unity/issues/2429