我什么都试过了,现在我被这个问题困了好几天了。无论我尝试什么,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";
}
}
}发布于 2019-02-24 20:37:42
对于那些看到这篇文章的人来说,有同样的问题:在你的代码中禁用保存游戏并登录将是有效的。云节约现在就坏了。下面关于该链接的最新评论是关于这个问题的。希望谷歌尽快修复它,云保存是非常方便的节省IAP购买等。
https://github.com/playgameservices/play-games-plugin-for-unity/issues/2429
https://stackoverflow.com/questions/54787429
复制相似问题