Skip to content

Use Player Leaderboards

This how-to submits and retrieves scores on a Player Leaderboard, where each entry is tied to an individual player.

Prerequisites

Submitting Score

Submit a score to a Player Leaderboard.

string leaderboardKey = "my_leaderboard";
int score = 1000;
LootLockerSDKManager.SubmitScore("", score, leaderboardKey, (response) =>
{
if (!response.success) {
Debug.Log("Could not submit score!");
Debug.Log(response.errorData.ToString());
return;
}
Debug.Log("Successfully submitted score!");
});

Check out the Reference Documentation for a more in-depth understanding of the endpoint.

Get Leaderboard Entries

Retrieve the first 50 Player Leaderboard entries.

string leaderboardKey = "my_leaderboard";
int count = 50;
LootLockerSDKManager.GetScoreList(leaderboardKey, count, 0, (response) =>
{
if (!response.success) {
Debug.Log("Could not get score list!");
Debug.Log(response.errorData.ToString());
return;
}
Debug.Log("Successfully got score list!");
});

Check out the Reference Documentation for a more in-depth understanding of the endpoint.

Get a Single Leaderboard Entry

Retrieve a single entry from a Player Leaderboard.

string leaderboardKey = "my_leaderboard";
string memberID = "50";
LootLockerSDKManager.GetMemberRank(leaderboardKey, memberID, (response) =>
{
if (!response.success) {
Debug.Log("Could not get the entry!");
Debug.Log(response.errorData.ToString());
return;
}
Debug.Log("Successfully got entry!");
});

Conclusion

You've submitted and retrieved scores on a Player Leaderboard. Next, see Use Scheduled Reset with Rewards to reward top-ranked players automatically.