文档

支持

Get the player's score

Retrieve the current player's score from a leaderboard.
阅读时间1 分钟最后更新于 1 个月前

Get the entry for the player in the specified leaderboard with the
GetPlayerScoreAsync
method:
public async void GetPlayerScore(string leaderboardId){ var scoreResponse = await LeaderboardsService.Instance .GetPlayerScoreAsync(leaderboardId); Debug.Log(JsonConvert.SerializeObject(scoreResponse));}
To get the score with any associated metadata, use the
IncludeMetadata
option on the
GetPlayerScoreOptions
configuration object:
public async void GetPlayerScore(string leaderboardId){ var scoreResponse = await LeaderboardsService.Instance .GetPlayerScoreAsync( leaderboardId, new GetPlayerScoreOptions { IncludeMetadata = true } ); Debug.Log(JsonConvert.SerializeObject(scoreResponse));}