谷歌播放服务在身份验证后不显示排行榜

Sum*_*ive 5 android leaderboard unity-game-engine google-play google-play-services

在这方面投入了大量时间,这是一个非常奇怪的事情。所以在这里问。

我正在使用这个插件并按照步骤https://github.com/playgameservices/play-games-plugin-for-unity

我只想在发布模式下为排行榜使用 Google Play 服务(我在 alpha 发布中使用)

这是我在 GPlay 服务中的 Auth 代码:

void Awake(){
    PlayerPrefs.SetInt("GameOverCount",0);

    #if UNITY_ANDROID
    Authenticate ();
    #endif}
Run Code Online (Sandbox Code Playgroud)

我已经通过提供 10 位以上的客户端 ID 配置了 Gplay 设置

我已经使用我正在使用的 release.keystore 的 SHA1 从 Google API 生成了 OAuth 客户端 ID。在开发人员控制台中的 Gplay 服务中:我已经发布了链接的应用程序,没有任何错误

public void Authenticate() {
    if (Authenticated || mAuthenticating) {
        Debug.LogWarning("Ignoring repeated call to Authenticate().");
        return;
    }


    PlayGamesClientConfiguration config = new PlayGamesClientConfiguration.Builder()
        .EnableSavedGames()
            .Build();
    PlayGamesPlatform.InitializeInstance(config);

    // Activate the Play Games platform. This will make it the default
    // implementation of Social.Active
    PlayGamesPlatform.Activate();

    // Set the default leaderboard for the leaderboards UI
    ((PlayGamesPlatform) Social.Active).SetDefaultLeaderboardForUI(leaderboardID_android);



    // Sign in to Google Play Games
    mAuthenticating = true;
    Social.localUser.Authenticate((bool success) => {
        mAuthenticating = false;
        if (success) {

            UnityAnalytics.CustomEvent("Auth Completed", new Dictionary<string, object>
                                       {
                { "isAuthDone", true }
            });

            if(showScores){

                Social.Active.ShowLeaderboardUI();
                Debug.Log("should show leaderborad");
            }
            // if we signed in successfully, load data from cloud
            Debug.Log("Login successful!");
        } else {
            // no need to show error message (error messages are shown automatically
            // by plugin)
            Debug.LogWarning("Failed to sign in with Google Play Games.");

            UnityAnalytics.CustomEvent("Auth Failed", new Dictionary<string, object>
                                       {
                { "isAuthDone", false }
            });

        }
    });
}
#if UNITY_ANDROID
    if (Authenticated) {
        showScores = false;
        ((PlayGamesPlatform)Social.Active).ShowLeaderboardUI(leaderboardID_android);
        Social.ShowLeaderboardUI();
        Debug.Log("should show leaderborad");

        UnityAnalytics.CustomEvent("Authenticated and show android leaderboard", new Dictionary<string, object>
                                   {
            { "isShowing", true }
        });

    }else{
        showScores = true;
        Authenticate();
    }
    #endif
Run Code Online (Sandbox Code Playgroud)

接下来,我发布 alpha 并检查 android 设备 - 我看到一个屏幕说连接到谷歌玩游戏...连接进程,然后离开屏幕。它似乎通过身份验证并关闭。但由于某种原因不显示排行榜。我无法理解为什么会发生这种情况以及缺少什么。

在我的统一分析中,只有一次没有加载分数,我玩了 20-30 次: 在此处输入图片说明

在我的开发者控制台中,分数数为空:

在此处输入图片说明

任何人都可以帮忙吗,我可以向可以帮助/想要帮助的人提供更多详细信息....谢谢...

小智 1

选择 Proguard for Minify > Release 并将内容复制到 Assets/Plugins/Android/proguard-user.txt

-keep class com.google.unity.** {
   *;
}
-keep public class com.google.android.gms.ads.**{
   public *;
}
-keep public class com.google.ads.**{
   public *;
}
-keepattributes *Annotation*
-dontobfuscate
-keep class com.google.android.gms.games.PlayGames { *; }
-keep class com.google.android.gms.games.leaderboard.** { *; }
-keep class com.google.android.gms.games.snapshot.** { *; }
-keep class com.google.android.gms.games.achievement.** { *; }
-keep class com.google.android.gms.games.event.** { *; }
-keep class com.google.android.gms.games.stats.** { *; }
-keep class com.google.android.gms.games.video.** { *; }
-keep class com.google.android.gms.games.* { *; }
-keep class com.google.android.gms.common.api.ResultCallback { *; }
-keep class com.google.android.gms.signin.** { *; }
-keep class com.google.android.gms.dynamic.** { *; }
-keep class com.google.android.gms.dynamite.** { *; }
-keep class com.google.android.gms.tasks.** { *; }
-keep class com.google.android.gms.security.** { *; }
-keep class com.google.android.gms.base.** { *; }
-keep class com.google.android.gms.actions.** { *; }
-keep class com.google.games.bridge.** { *; }
-keep class com.google.android.gms.common.ConnectionResult { *; }
-keep class com.google.android.gms.common.GooglePlayServicesUtil { *; }
-keep class com.google.android.gms.common.api.** { *; }
-keep class com.google.android.gms.common.data.DataBufferUtils { *; }
-keep class com.google.android.gms.games.quest.** { *; }
-keep class com.google.android.gms.nearby.** { *; }
Run Code Online (Sandbox Code Playgroud)

这对我来说是工作。