Search code examples
unity-game-enginegoogle-play-servicesleaderboard

Google play leaderboards not updating the score after new score has been reported


I have been struggling with this problem for a few days... I have google play services set up, my achievements work properly, but the leaderboard doesn't seem to want to work. This is the code that reports new score to the leaderboard:

 public static void AddScoreToLeaderboard(string LeaderboardId, long score) {
    Social.ReportScore(score, LeaderboardId, success => { Debug.Log("Leaderboard updated: "+score); });
}

When the function is called i get the debug message saying that the leaderboard has been updated but when i go back to the leaderboard which i display with this:

public static void ShowLeaderboardsUI()
{
    Social.ShowLeaderboardUI();
}

The leaderboard is completely empty... Any help will be appreciated.


Solution

  • So another user on github suggested this and it worked for me.

    I had same problem with my game but i resolved that. Follow the steps carefully: 1-Go to https://console.developers.google.com/apis/credentials 2-Remove all credentials 3-Go to https://play.google.com/apps/publish 4-In all applications tab click on your game 5-Then from left menu click on Release Management and then go to App signing 6-Copy the code of SHA1 from the App signing certificate part 7-Go back to https://console.developers.google.com/apis/credentials 8-Create credentials and choose OAuth client ID 9-Choose application type (it was android for me!) 10-paste the code you copied from part 6 in Signing-certificate fingerprint field 11-Write the package name of the game exactly in Package name field the click on create 12-Go back to https://play.google.com/apps/publish 13-click on Game Services and then click on your game 14-Click on Link apps from left menu 15-click on Link another app 16-Choose your platform (android for me!) 17-write a name 18-click on Package name field and choose your package name there 19-save and publish the linked app that you just created 20-compare the OAuth2 Client ID from linked app that you just created with Client ID in credentials you created in part 11 21-if they have the same code the leaderboard will work fine! Hope it solves your problem!