文档

支持

Get scores for other players

Retrieve scores for specific players in a leaderboard.
阅读时间1 分钟最后更新于 1 个月前

Get the scores for other players in the specified leaderboard with the
GetScoresByPlayerIdsAsync
method:
public async void GetScoresByPlayerIds(string leaderboardId){ var playerIds = new List<string>{ "abc123", "abc456" }; var scoresResponse = await LeaderboardsService.Instance .GetScoresByPlayerIdsAsync(leaderboardId, playerIds); Debug.Log(JsonConvert.SerializeObject(scoresResponse));}
To get the score with any associated metadata, use the
IncludeMetadata
option on the
GetScoresByPlayerIdsOptions
configuration object:
public async void GetScoresByPlayerIdsWithMetadata(string leaderboardId){ var playerIds = new List<string>{ "abc123", "abc456" }; var scoreResponse = await LeaderboardsService.Instance .GetScoresByPlayerIdsAsync( leaderboardId, playerIds, new GetScoresByPlayerIdsOptions { IncludeMetadata = true } ); Debug.Log(JsonConvert.SerializeObject(scoresResponse));}