Comment on page
Use a Progression System In-Game
The following tutorial assumes you have already set up your game and made your first API calls. To learn how to do that, visit the Getting Started guide.
After setting up progression with levels and awards in the console, it's time to actually use this in your game.
At an appropriate time in your game you call the submit XP endpoint like so
Unity
REST
int scoreToSubmit = 100;
LootLockerSDKManager.SubmitXp(scoreToSubmit , (response) =>
{
if (response.success)
{
Debug.Log("Successful");
}
else
{
Debug.Log("Error: " + response.Error);
}
});
curl -X POST "https://api.lootlocker.io/game/v1/player/xp" \
-d "{\"points\": 100}" \
-H "Content-Type: application/json"
To read more about the response of the call to the endpoint, please check out the documentation in our reference section for Submit XP
If you want to know how much XP a player currently have, you can use the Get Player Info endpoint to do so.
Unity
REST
LootLockerSDKManager.GetXpAndLevel((response) =>
{
if (response.success)
{
Debug.Log("Successful");
}
else
{
Debug.Log("Error: " + response.Error);
}
});
curl -X GET "https://api.lootlocker.io/game/v1/player/info"
To learn more about the endpoint you can check out our reference documentation on getting player info
Last modified 1mo ago