Skip to content

Use Metadata to Store Additional Information

This how-to submits a score to a Leaderboard along with Metadata, using a player's country as an example.

Prerequisites

Submit Score with Metadata

In this example, the player has already chosen or been assigned a country, which is submitted as Metadata alongside their score.

string leaderboardKey = "my_leaderboard";
int score = 1000;
string metadata = "country:" + PlayerPrefs.GetString("PlayerAssignedCountry"); // Replace PlayerPrefs.GetString("PlayerAssignedCountry") with an existing way of getting the configured country for the player in your game
LootLockerSDKManager.SubmitScore("", score, leaderboardKey, metadata, (response) =>
{
if (!response.success) {
Debug.Log("Could not submit score!");
Debug.Log(response.errorData.ToString());
return;
}
Debug.Log("Successfully submitted score!\n with metadata: " + metadata);
});

Conclusion

You've submitted a score to a Leaderboard along with Metadata. Next, see Use Scheduled Reset with Rewards to reward top-ranked players automatically.