Concurrent Players
How it Works
Example: Start Concurrent Sessions and Submit Scores
// Replace with your actual leaderboard key
public static string leaderboardKey = "your_leaderboard_key_here";
public void OnLoginButtonPressed()
{
// Replace with your actual player identifier retrieval logic
string guest_player_identifier = GetGuestIdentifierFromInput();
if (string.IsNullOrEmpty(guest_player_identifier))
{
Debug.LogWarning("Please enter a valid guest player identifier.");
return;
}
LootLockerSDKManager.StartGuestSession(guest_player_identifier, response =>
{
if (!response.success)
{
Debug.LogError($"Login failed: {response.errorData}");
return;
}
Debug.Log($"Login successful for guest player: {guest_player_identifier} with ulid {response.player_ulid}. The default player ulid is {LootLockerSDKManager.GetDefaultPlayerUlid()}");
});
}
public void OnShowScoresButtonPressed()
{
// Fetch the top 10 scores from the leaderboard, while we recommend always specifying which player
// you want to make the request for, this is an example of making a request for the default player (simply not specifying a player).
LootLockerSDKManager.GetScoreList(leaderboardKey, 10, 0, response =>
{
if (!response.success)
{
Debug.LogError($"Failed to retrieve scores: {response.errorData}");
return;
}
Debug.Log($"Scores retrieved successfully: {response.text}");
// Replace with your actual UI display logic
DisplayScoresInUI(response.items);
}/*, lootLockerPlayerUlid <- To make the request for a specific player you'd add this parameter*/);
}
public void OnMatchFinished_SubmitScores()
{
// Replace with your actual game logic
MatchData matchData = GetCurrentMatchData();
foreach (var playerScore in matchData.PlayerScores)
{
// Submit each player's score to the leaderboard
LootLockerSDKManager.SubmitScore("", playerScore.Score, leaderboardKey, response =>
{
if (!response.success)
{
Debug.LogError($"Failed to submit score for player {playerScore.PlayerId}: {response.errorData}");
}
else
{
Debug.Log($"Score submitted successfully for player {playerScore.PlayerId}: {response.text}");
}
}, /* IMPORTANT: */ playerScore.LootLockerPlayerULID /* This makes the score submission for *this* player */);
}
}Last updated
Was this helpful?



