0
\$\begingroup\$

My game uses Google Play Game Services for leaderboard management.

In my production build, submitting high scores to and requesting the leaderboard for display from Google Play Games services works flawlessly. However, in my latest development build (open to internal testers), I am having trouble submitting highscores to the leaderboard.

Here's the code that submits a highscore.

public void SetHighscore(uint newHighscore)
{
    highScoreInfo = new HighScoreStruct(newHighscore);
    mainPlayer.highScoreTextBox.text = string.Format("High Score: {0}", highScore);
    googlePlayGamesManager?.ReportScore((int)highScore);
    Save(highScoreInfo);
}

googlePlayGamesManager's ReportScore method looks as follows:

public void ReportScore(int score)
    {
        if (!Social.localUser.authenticated)
        {
            AuthenticateUserOnUnitySocial();
        }
        if (!bLocalUserUnityAuthenticated)
        {
            Debug.LogWarning("Local User not authenticated. Can't submit highscore.");
        }
        else
        {
            Debug.Log("Local user authenticated. Trinyg to submit highscore.");
        }
        // post score 12345 to leaderboard ID "Cfji293fjsie_QA" and tag "FirstDaily")
        Social.ReportScore(score, GPGSIds.leaderboards_my_leaderboard, (bool success) => {
            // handle success or failure
            if (success)
                Debug.Log("Submitted highscore successfully");
            else
                Debug.LogWarning("Failed to submit highscore");
        });
    }

I have verified that GPGSIds.leaderboards_my_leaderboard contains the correct leaderboard ID, yet I get errors when trying to submit scores to the leaderboard.

Here are the logs I get every time I try to submit a score to the leaderboard:

05-08 22:08:44.719 14588 14646 I Unity   : Local user authenticated. Trinyg to submit highscore.
05-08 22:08:44.719 14588 14646 I Unity   : GooglePlayGamesManager:ReportScore(Int32)
05-08 22:08:44.719 14588 14646 I Unity   : HighScoreManager:SetHighscore(UInt32)
05-08 22:08:44.719 14588 14646 I Unity   : ExtraBallPowerup:OnTriggerEnter2D(Collider2D)
05-08 22:08:44.719 14588 14646 I Unity   : 
05-08 22:08:44.720 14588 14646 E Unity   : Leaderboard not found
05-08 22:08:44.720 14588 14646 E Unity   : UnityEngine.SocialPlatforms.Local:ReportScore(Int64, String, Action`1)
05-08 22:08:44.720 14588 14646 E Unity   : HighScoreManager:SetHighscore(UInt32)
05-08 22:08:44.720 14588 14646 E Unity   : ExtraBallPowerup:OnTriggerEnter2D(Collider2D)
05-08 22:08:44.720 14588 14646 E Unity   : 
05-08 22:08:44.721 14588 14646 W Unity   : Failed to submit highscore
05-08 22:08:44.721 14588 14646 W Unity   : UnityEngine.SocialPlatforms.Local:ReportScore(Int64, String, Action`1)
05-08 22:08:44.721 14588 14646 W Unity   : HighScoreManager:SetHighscore(UInt32)
05-08 22:08:44.721 14588 14646 W Unity   : ExtraBallPowerup:OnTriggerEnter2D(Collider2D)

I am unsure as to why I get the message saying "Leaderboard not found". Moreover, as stated, everything works fine in the production build, and, as far as I can tell, there are no changes to any of the files involved in highscore management.

Would anyone have a clue as to why I am getting this error message?

\$\endgroup\$
2
  • 1
    \$\begingroup\$ Has this worked on your development build before (since it works in production) ? If your project is versioned controlled, could you tell which commit after your production build introduced this issue? That might point you to the right direction. Development builds need different configuration to work with Google Play Game Services, but it looks like you can authenticate without issues, so not sure what's going on there. \$\endgroup\$ Commented May 16, 2023 at 11:00
  • \$\begingroup\$ I THINK it worked with my development build before, but I can’t tell for sure, since I took 6 months break from this project :( \$\endgroup\$
    – ChrisC
    Commented May 17, 2023 at 15:00

2 Answers 2

0
\$\begingroup\$

Usually, even if the error not telling us, this might actually be related to the API Oauth for the Google Play Console. Your authentication may not be set correctly or corrupted. Try to re-authorize the Google Play Console.

\$\endgroup\$
0
\$\begingroup\$

Choose Proguard for Minify > Release and Copy the content into 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.** { *; }

It's work for me.

\$\endgroup\$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .