playgameservices / play-games-plugin-for-unity

Google Play Games plugin for Unity
Other
3.43k stars 953 forks source link

Can't load local player score. #3188

Open shefich opened 1 year ago

shefich commented 1 year ago

Describe the bug I can't load local player score. LoadScores returns "success" but scores length is 0 and no ulb.localUserScore.value is presented. BTW my score is uploaded and I can see it in the leaderboard.

My code: public void getLocalPlayerScore () { if (!Social.localUser.authenticated) return; //StringBuilder output = new StringBuilder (); ILeaderboard ulb = PlayGamesPlatform.Instance.CreateLeaderboard(); ulb.id = leaderboard; ulb.SetUserFilter (new string[] { PlayGamesPlatform.Instance.localUser.id }); ulb.LoadScores ((bool usuccess) => { if (usuccess) { if (ulb.scores.Length > 0) { PlayerPrefs completedLevels = " + PlayerPrefs.GetInt("completedLevels", 0)); //loaded high passed level from play services if (gcHiScore > PlayerPrefs.GetInt("completedLevels", 0)) { BizzyBeeGames.Sudoku.GameManager.Instance.SetNumberOfCompletedLevels(gcHiScore); PlayerPrefs.SetInt("completedLevels", gcHiScore); } } else { } } else { } }); }

Versions

Additional context Add any other context about the problem here.