Use Player Leaderboards
Last updated
Last updated
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 our ref documentation for a more in-depth understanding of the endpoint!
To copy and paste the above example into your editor, look here.
Input
You need to exchange the TriggerSubmitScore
event for whatever event you want to use to trigger this flow.
Replace the input variables with the data you want to submit to the leaderboard.
Output
We recommend branching the completed events on the success flag in the response, and if you do this, you will probably want to add error handling in case the request fails as well as what (if any) continued actions you want on success.
Check out our ref documentation for a more in-depth understanding of the endpoint!
var leaderboardKey : String = "my_leaderboard";
var score : int = 1000;
var response = await LL_Leaderboards.SubmitScore.new(leaderboardKey, score).send()
if(!response.success) :
# Request failed, handle errors
pass
else:
# Request succeeded, use response as applicable in your game logic
pass
curl -X POST "https://api.lootlocker.io/game/leaderboards/1/submit" \
-d "{\"score\": 1000}" \
-H "Content-Type: application/json"
Check out our ref documentation for a more in-depth understanding of the endpoint!
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 our ref documentation for a more in-depth understanding of the endpoint!
To copy and paste the above example into your editor, look here.
Input
You need to exchange the TriggerGetScores
event for whatever event you want to use to trigger this flow. Replace the input variables with your leaderboard key, and how many items you want to get.
Output
We recommend branching the completed events on the success flag in the response, and if you do this, you will probably want to add error handling in case the request fails as well as what (if any) continued actions you want on success. If you want to fetch more items on the score list, you'll want to save the pagination information for later use.
Check out our ref documentation for a more in-depth understanding of the endpoint!
var leaderboardKey : String = "my_leaderboard";
var count : int = 50;
var response = await LL_Leaderboards.GetScoreList.new(leaderboardKey, count).send()
if(!response.success) :
# Request failed, handle errors
pass
else:
# Request succeeded, use response as applicable in your game logic
pass
curl -X GET "https://api.lootlocker.io/game/leaderboards/1/list?count=50"
Check out our ref documentation for a more in-depth understanding of the endpoint!
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!");
});
To copy and paste the above example into your editor, look here.
Input
You need to exchange the TriggerGetScores
event for whatever event you want to use to trigger this flow. Replace the input variables with your leaderboard key and what member you want to fetch.
Output
We recommend branching the completed events on the success flag in the response, and if you do this, you will probably want to add error handling in case the request fails as well as what (if any) continued actions you want on success.
var leaderboardKey : String = "my_leaderboard";
var memberId : String = "a_member_id";
var response = await LL_Leaderboards.GetMemberRank.new(leaderboardKey, memberId).send()
if(!response.success) :
# Request failed, handle errors
pass
else:
# Request succeeded, use response as applicable in your game logic
pass
curl -X GET "https://api.lootlocker.io/game/leaderboards/1/member/1"