Get the player’s score from a Leaderboard version

Players can get their entry in the specified leaderboard archive version with the GetVersionPlayerScoreAsync method:

C#

public async void GetPlayerVersionScore()
{
    var versionId = "";
    var scoreResponse = await LeaderboardsService.Instance
        .GetVersionPlayerScoreAsync(leaderboardId, versionId);
    Debug.Log(JsonConvert.SerializeObject(scoreResponse.Result));
}

To get the score with any associated metadata, use the IncludeMetadata option in the GetPlayerVersionScoreOptions configuration object:

C#

public async void GetPlayerVersionScoreWithMetadata()
{
    var scoreResponse = await LeaderboardsService.Instance
        .GetVersionPlayerScoreAsync(
            leaderboardId,
            versionId,
            new GetPlayerVersionScore { IncludeMetadata = true });
    Debug.Log(JsonConvert.SerializeObject(scoreResponse));
}

Metadata is not retrieved by default.

For details on how to get available leaderboard version IDs, visit Get available leaderboard version.

For methods that retrieve scores: if your player has not submitted a score and the leaderboard is bucketed, the player is not assigned a bucket. A failed score retrieval returns an error that has its Reason field set to ScoreSubmissionRequired.