- Home /
Wrong values for ILeaderboard.maxRange
I'm trying to determine the number of entries in a Game Circle leaderboard.
After calling ILeaderboard.LoadScores, I receive the expected data in ILeaderboard.scores, but the value of maxRange, which should be the total amount of scores the leaderboard contains, seems to be set to a large random number, different after each score request. What should I do to get the correct value?
ILeaderboard unityLeaderboard;
void RequestLeaderboard(string leaderboardToRequest)
{
unityLeaderboard = Social.CreateLeaderboard();
unityLeaderboard.id = leaderboardToRequest;
unityLeaderboard.range = new Range(1, 25);
unityLeaderboard.timeScope = TimeScope.AllTime;
unityLeaderboard.userScope = UserScope.Global;
unityLeaderboard.LoadScores(HandleLoadScoresCompleted);
}
void HandleLoadScoresCompleted(bool success)
{
if (success)
Debug.Log(unityLeaderboard.maxRange);
}
I'm having the exact same issue, anyone knows how to fix that?
I mentioned Game Circle by mistake in the question, but when I was having this issue it was in fact for iOS Game Center. Because I could not fix this using Unity's Social API I switched to using prime[31]'s Game Center plugin.
You're right, Unity doesn't seem to fill up the maxRange property from the iOS GameCenter leaderboards... So I ended up writing an iOS plugin that does retrieve my leaderboard maxRange. I hope they fix that someday, should be fairly easy to fix!
Answer by eddyb · Apr 20 at 02:54 AM
7 years later, and I'm having the same problem. That is, after a call to LoadScores, maxRange is some random, large integer. So I tried writing my own plugin, and get the correct value in my objective-c call, so this really seems to be a Unity bug that has never been fixed. If you need this value, write your own plugin I guess, or use Prime31's plugin, which apparently works a lot better than Unity's API.