我正在尝试将 Google Play 服务添加到我的 Android 应用中。当我在 Unity Editor 中调用Social.localUser.Authenticate时,它会向回调函数返回 false。但是当我的手机运行调试版本时,没有调用回调函数。并且没有错误信息出来。
这是我的代码。
public void Init()
{
// Initialize Play Games Configuration and Activate it.
PlayGamesClientConfiguration config = new PlayGamesClientConfiguration.Builder()
.EnableSavedGames()
.RequestEmail()
.RequestServerAuthCode(false)
.RequestIdToken()
.Build();
PlayGamesPlatform.InitializeInstance(config);
PlayGamesPlatform.DebugLogEnabled = true;
PlayGamesPlatform.Activate();
Debug.LogFormat("SignInOnClick: Play Games Configuration initialized");
}
public void SignInWithPlayGames()
{
if (Social.localUser.authenticated) {
return;
}
// Sign In and Get a server auth code.
Debug.Log("Start Auth GPGS");
Social.localUser.Authenticate((bool success) =>
{
Debug.Log("The lines below never call :("); // <<<<<<<<<<<<<<<<<<<<<<<<<<<
if …Run Code Online (Sandbox Code Playgroud) android unity-game-engine google-play-services google-play-games