I get error messages when I want to use Contains to get the value of a statistic:
Error CS1503: Argument 1: cannot convert from 'string' to 'PlayFab.ClientModels.StatisticModel' Error CS1503: Argument 1: cannot convert from 'string' to 'int'
I need to get the values of several statistics for each of the 20 players. Then, I add the values into the corresponding list. If a certain statistic doesn't exist, then I want to add 0 to the corresponding list.
But I don't know how to use Contains because it doesn't take a string.
How can I find out if a statistic exists and get its value? Can I use Contains?
List<int> Levelsplayedlist = new List<int>(); List<int> Countrylist = new List<int>(); var result = await PlayFabClientAPI.GetLeaderboardAsync(new GetLeaderboardRequest() { StatisticName = "Level 1", MaxResultsCount = 20, ProfileConstraints = new PlayFab.ClientModels.PlayerProfileViewConstraints() { ShowStatistics = true, ShowDisplayName = true, ShowAvatarUrl = true, ShowTags = true, ShowCreated = true, ShowLastLogin = true } }); foreach (var entry in result.Result.Leaderboard) { if (entry.Profile.Statistics.Contains("Total levels played")) Levelsplayedlist.Add(entry.Profile.Statistics["Total levels played"].Value); if (entry.Profile.Statistics.Contains("Playercountry")) Countrylist.Add(entry.Profile.Statistics["Playercountry"].Value); }