- Home /
Question by
KaustavDG123 · Jun 14, 2019 at 10:20 PM ·
c#google play gamesleaderboardleaderboards
Loading Scores from Google Leaderboard always shows 1 Entry in a Leaderboard with over 5 scores posted
I am trying to retrieve all the scores from Google Leaderboard.
When I use Social.ShowLeaderboardUI();
I get all my scores that has been posted but when I am trying to retrieve it using the following piece of code I found in Google Play Games tutorial on GIT:
internal void LoadUsersAndDisplay(ILeaderboard lb)
{
// get the user ids
List<string> userIds = new List<string>();
foreach(IScore score in lb.scores) {
userIds.Add(score.userID);
}
// load the profiles and display (or in this case, log)
Social.LoadUsers(userIds.ToArray(), (users) =>
{
string status = "Leaderboard loading: " + lb.title + " count = " +
lb.scores.Length;
foreach(IScore score in lb.scores) {
IUserProfile user = FindUser(users, score.userID);
status += "\n" + score.formattedValue + " by " +
(string)(
(user != null) ? user.userName : "**unk_" + score.userID + "**");
}
Debug.log(status);
});
}
It returns the score of just one player, although there are more than 5 scores posted on the leaderboard the lb.scores.Length
returns 1 and I get the score of just one player.
I have no idea why this is happening can someone please point me in the right direction. Thanks in advance.
Comment