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
1
int scoreToSubmit = 100;
2
3
LootLockerSDKManager.SubmitXp(scoreToSubmit , (response) =>
4
{
5
if (response.success)
6
{
7
Debug.Log("Successful");
8
}
9
else
10
{
11
Debug.Log("Error: " + response.Error);
12
}
13
});
Copied!
1
curl -X POST "https://api.lootlocker.io/game/v1/player/xp" \
2
-d "{\"points\": 100}" \
3
-H "Content-Type: application/json"
Copied!
To read more about the response of the call to the enpoint, please check out the documentation in our reference section for Submit XP
It's also possible to award XP as part of a trigger
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
1
LootLockerSDKManager.GetXpAndLevel((response) =>
2
{
3
if (response.success)
4
{
5
Debug.Log("Successful");
6
}
7
else
8
{
9
Debug.Log("Error: " + response.Error);
10
}
11
});
Copied!
1
curl -X GET "https://api.lootlocker.io/game/v1/player/info"
Copied!
To learn more about the endpoint you can check out our reference documentation on getting player info
Last modified 1mo ago
Copy link