playgameservices / play-games-plugin-for-unity

Google Play Games plugin for Unity
Other
3.46k stars 966 forks source link

Google Play Leaderboard UI Not Loading after posting score #2045

Closed HigherPixel closed 6 years ago

HigherPixel commented 6 years ago

Hello, I'm working on a game that is in alpha on the google play store. I have everything set and I'm able to login into google play and post a score to the leaderboard. The problem lies in after I post the score and go back to main menu and click on my leader board, I'm stuck in a infinity loading loop to pull up the leader board.

img-0291

Here is the code for getting the leaderboards

private void Awake() { PlayGamesClientConfiguration config = new PlayGamesClientConfiguration.Builder().Build(); PlayGamesPlatform.InitializeInstance(config); PlayGamesPlatform.Activate(); Social.localUser.Authenticate((bool success) => { // handle success or failure if (success) { //updateScore(); PlayGamesPlatform.Activate(); } else Debug.Log("Auth wrong : (");

    });
}

public void Leaderboards() { // show leaderboard UI if (PlayGamesPlatform.Instance.localUser.authenticated) { PlayGamesPlatform.Instance.ShowLeaderboardUI(); } else { Debug.Log("Cannot show leaderboard: not authenticated"); } } The problem only occurs after posting. I have uninstalled the app and installed it again and I see that the Leaderboard has changed correctly but when I post a score, It is stuck loading.

I have been looking everywhere on the issues listed and none of the solutions listed have worked for me. Is anyone else having this issue.

HigherPixel commented 6 years ago

img-0292 img-0293 img-0294

After waiting 40+ mins with phone left on, it loaded it. I don't understand why it takes so long to load after posting score.

I tried to post another score after that and now I'm back with the infinity loading loop

img-0296

aykutuludag commented 6 years ago

Same issue. In addition, achievements does not save and in void Start() login method does not react I don't know why. This build is very problematic and contains many bugs.

vijayvjc8 commented 6 years ago

Yes, I'm facing this problem from a month, taught I was doing some wrong code, please do something I'm stuck here from month, I use current build of gpgs and unity 2017.2.of3........someone if you know how to solve this pls help us

NavidaUB commented 6 years ago

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!

vijayvjc8 commented 6 years ago

I don't know who you are? I don't even know how to thank you, thank you so much, my problem got solved, heartfull thanks๐Ÿ˜—๐Ÿ˜—๐Ÿ˜

On 8 Dec 2017 23:52, "NavidaUB" notifications@github.com wrote:

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!

โ€” You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/playgameservices/play-games-plugin-for-unity/issues/2045#issuecomment-350335234, or mute the thread https://github.com/notifications/unsubscribe-auth/AgwD74P1Qnh9Biu79dsRqquJuupP7SLCks5s-X5wgaJpZM4Qz7FU .

HigherPixel commented 6 years ago

I followed the steps but it didn't work for me. I'm still having problems with very long loading after updating the leader boards.

NavidaUB commented 6 years ago

@HigherPixel Does the OAuth2 Client ID match with Client ID in step 20?

NavidaUB commented 6 years ago

@vijayvjc8 Glad to hear that ๐Ÿ‘

HigherPixel commented 6 years ago

@NavidaUB I followed your steps listed thoroughly and I still reached the same outcome as earlier. The OAuth2 Client ID in the credentials matches that of the ClientID in the game service.

egonaraujo commented 6 years ago

I have also the same problem, only difference is that i'm trying to load scores to populate my own leaderboard (leaderboardUI also gives error)

[Play Games Plugin DLL] 12/14/17 22:56:40 -02:00 DEBUG: Starting Auth Transition. Op: SIGN_OUT status: ERROR_NOT_AUTHORIZED

I don't know why, but my ILeaderboard.LoadScores() gives an error of SIGN_OUT?

What I eventually did on my code was:

Social.ReportScore (score, leaderboard,( success) => {
    ...
      submitted = true;
    });

public void UpdateLeaderboard ()
  {
    StartCoroutine (GetLeaderboardData ());
  }

private IEnumerator GetLeaderboardData ()
  {
    yield return new WaitUntil (() => {return submitted; });

#if UNITY_ANDROID
    ILeaderboard lb = PlayGamesPlatform.Instance.CreateLeaderboard ();
#else
    ILeaderboard lb = Social.CreateLeaderboard ();
#endif
    lb.id = leaderboard;
    lb.LoadScores ((ok) => {
      if (ok) {
        ShowLeaderboard (lb);
      } else {
        #if UNITY_ANDROID
        if (!PlayGamesPlatform.Instance.IsAuthenticated ()) {
          PlayGamesClientConfiguration config = new PlayGamesClientConfiguration.Builder ().Build ();
          PlayGamesPlatform.InitializeInstance (config);
          // Recommended for debugging:
          PlayGamesPlatform.DebugLogEnabled = true;
          // Activate the Google Play Games platform
          PlayGamesPlatform.Activate ();
        }
        #endif
        Social.localUser.Authenticate ((success) => {
          UpdateLeaderboard ();
        });
      }
    }
    );
  }

Basically, I submit score and set a variable, when that is set, my leaderboard starts to try to update. If there's an error (usually Starting Auth Transition. Op: SIGN_OUT status: ERROR_NOT_AUTHORIZED), I restart my PlayGamesPlatform, probably inserting A LOT of memory here, and call the localUser.Authenticate() Again.

It usually takes 3 loops on this: Error on loadscore > reset playgames platform > try to authenticate > try to loadscore>error>repeat and about 1 and 3 minutes for all these requests pass through.

Before this trial, I had the callback from submitScore calling loadScores, but the same error appeared. All IDs, OAuth Keys, SHA1 and so on is double checked and correct, So that so, that after 3 trials of bruteforcing my loadScore, it magically appears. Please Fix

egonaraujo commented 6 years ago

And I'm fairly sure that the problem lies on this https://github.com/playgameservices/play-games-plugin-for-unity#retrieving-server-authentication-codes , more specifically

If your back end server interactions requires you to send a server auth code more than once per authenticated session

I know it's not an backend server, but maybe the google API that this plugin access need to refresh it's token. I tried to find the code on the project to create a pull request but i was unsuccessful

Can someone from google play confirm this?

HigherPixel commented 6 years ago

I solved my problem by putting the app in production. I guess Google play Service is slow in alpha and beta.

Here's a link if you want to check out game: https://play.google.com/store/apps/details?id=com.HighPixelStudios.WillOhFlow&rdid=com.HighPixelStudios.WillOhFlow

enosoft commented 5 years ago

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!

thank you very much. @NavidaUB your solution solved all my problems., thank you, thank you, thank you :)

kcheeb commented 5 years ago

what happens if the 2 client ID's dont match? am i screwed?

ngost commented 4 years ago

OMG... Thank you! enosoft your processing's mean is sync the console play service's connected app's client id and developed console's outh2 client id correctly! Thank you again bro.

CandyGaming commented 4 years ago

Hello, When I did it, it doesnt connect. Does it need to be released for beta or alpha? I send it to beta but it isnt released currently. Thank you.

morganfreemanX commented 3 years ago

Thanks! @NavidaUB .

I solved this issue by checking SHA-1. The problem is I created a OAuth 2.0 client with wrong SHA-1.

I created an OAuth 2.0 client ID before submit apk for testing. The SHA-1 changed after release. So Google Play Service auto created one for me when I release.

Please check below step! 1.Check whether there are 2 different OAuth 2.0 client ID. 2.If Google Play Service auto create one for you. back to Google Play Console, and choose the right OAuth client with right SHA-1. 3.If there isn't, please follow NavidaUB step to create now OAuth client.

steam3d commented 1 year ago

For me it did not help. I have right OAuth client with right SHA-1 and Google Play Leaderboard has still loaded infinity