Google Play Services leaderboard not updating after high score is beaten?
Hi, I've been developing a game for android and I have wanted to incorporate a leader board so that players can compete with each other for the top score. I have an internal test on the Play Store setup so that friends and I can test everything out to see if it's working. So far I was able to get my score on the leader-board and when people beat my score their score is then put on the top, etc. However once me and someone else both have an existing score on the leader-board it appears that the score's will not update if beaten. It's as if because I already have a score on the leader-board it's not letting me add the higher one.
I have the usual setup for using a leader-board, a separate class to handle authenticating with Google Play Services and using the leader-board, the function in this class that adds the score looks like this:
public void AddScoreToLeaderboard(string leaderboardID, int score)
{
Social.ReportScore((long)score, leaderboardID, success => { });
}
Then at the end of each game, when the game over menu appears, this line is called which calls the above function in the Leaderboard class (I've blocked out the leader-board ID):
leaderboard.AddScoreToLeaderboard("exampleID1234", runtime.GetComponent<ScoreTracker>().score);
I've done this since the actual high score is stored in Player Prefs which could be edited by knowledgeable players, so instead at the end of each run the current score stored in my ScoreTracker script is submitted. At this point a player can use one revive though which just means at the end of that run and the game over screen appears again the line above is called once again, which should just update the score if higher regardless.
Is this a bad way about going using the google play leader-board system and is there something I'm doing wrong?
Any help would be greatly appreciated, thanks.
Answer by LetalisDev · Jun 06, 2020 at 11:28 AM
Never-mind, it seems like the scores just take longer to update sometimes than others.
@LetalisDev When you had those delays does it only updated on the "today" section of the leaderboard and not "all time"? Just asking because I think I'm going through the same situation where a higher score on the same account won't update, but only happends in the "all time" section which is not good since that is the most important one.
I honestly can't remember for sure but I'd assume it would go through to the "today" section first, since things might get transferred to the "all time" section on a round about 24-hour basis. It's easy to think there's something wrong with your code especially when trying to integrate something like this for the first time but I just imagine it will just take a while to go through. Give it some time and see what happens.
Thank you for the quick response, I'll wait then and hope for the best to come.