Unity3d 如何将Google登录正确集成到我的Unity Android应用程序构建中
当我在Unity上运行时,我得到了 配置创建 配置已初始化 激活 无法登录到游戏服务。 试图登录 这很好,因为我正在用我的电脑测试它。但我在真正的设备上运行我的应用程序后得到了一个有趣的结果。我明白了: 配置创建 配置已初始化 激活 试图登录Unity3d 如何将Google登录正确集成到我的Unity Android应用程序构建中,unity3d,google-play,Unity3d,Google Play,当我在Unity上运行时,我得到了 配置创建 配置已初始化 激活 无法登录到游戏服务。 试图登录 这很好,因为我正在用我的电脑测试它。但我在真正的设备上运行我的应用程序后得到了一个有趣的结果。我明白了: 配置创建 配置已初始化 激活 试图登录 我认为如果使用PlayGames()方法从public void SignInWithPlayGames()中跳过(成功)。我的应用程序从未显示Google Play用户界面,我现在不确定我是否使用了正确的代码。在过去几周里,我一直在为Google Pla
我认为如果使用PlayGames()方法从public void SignInWithPlayGames()中跳过(成功)。我的应用程序从未显示Google Play用户界面,我现在不确定我是否使用了正确的代码。在过去几周里,我一直在为Google Play苦苦挣扎。但是,我没有在生成器中检索ID标记或身份验证标记。这可能会给你带来麻烦 此外,您需要将社交用户强制转换为google用户才能访问其属性 我让它与以下代码一起工作。(如果您无法使用此代码,则问题在于您在google play插件和/或google play控制台中的设置。)
谢谢但是,它仍然给出了相同的结果。我也尝试过更新SHA1,但没有成功。
private string text;
void Start()
{
PlayGamesClientConfiguration config = new PlayGamesClientConfiguration.Builder().RequestIdToken().RequestServerAuthCode(false).Build();
text = "config created";
PlayGamesPlatform.InitializeInstance(config);
text = text + "\n" + "config initialized";
PlayGamesPlatform.Activate();
text = text + "\n" + "activated";
SignInWithPlayGames();
text = text + "\n" + "attempted to sign in";
}
public void SignInWithPlayGames()
{
UnityEngine.Social.localUser.Authenticate((bool success) =>
{
if (success)
{
string authCode = PlayGamesPlatform.Instance.GetServerAuthCode();
text = text + "\n" + "Auth code is: " + authCode;
if (string.IsNullOrEmpty(authCode))
{
text = text + "\n" + "Signed into Play Games Services but failed to get the server auth code.";
return;
}
}
if (!success)
{
text = text + "\n" + "Failed to Sign into Play Games Services.";
return;
}
});
}
PlayGamesClientConfiguration config = new
PlayGamesClientConfiguration.Builder()
.Build();
// Enable debugging output (recommended)
PlayGamesPlatform.DebugLogEnabled = true;
PlayGamesPlatform.InitializeInstance(config);
PlayGamesPlatform.Activate();
Social.localUser.Authenticate((bool success) =>
{
var googleUser = ((PlayGamesLocalUser)Social.localUser);
if (googleUser.authenticated)
{
// access googleUser properties and store them or use them
}
}