EDIT: oh sorry, incorrect category
I have a list of game modes and trying to add a set of statistics too each one of them as shown in the code snippet bellow.
The code logs the correct number of added stats, however the stats are not actually updated, when I check them in the Statistics tab on PlayFab, it's empty. But when I remove the for loop and only add the stats manually like "rank", it works so I'm guessing for loops break it for some reason.
Any ideas?
public static class Gamemodes { public static List<Gamemode> gamemodes = new List<Gamemode> { new Gamemode {shortName = "TDM"}, new Gamemode {shortName = "FFA"}, new Gamemode {shortName = "KD"}, new Gamemode {shortName = "CP"}, new Gamemode {shortName = "SAD"}, new Gamemode {shortName = "LOCATE"} }; } var request = new PlayFab.ServerModels.UpdatePlayerStatisticsRequest { PlayFabId = playFabID, Statistics = new List<PlayFab.ServerModels.StatisticUpdate>() }; request.Statistics.Add(new PlayFab.ServerModels.StatisticUpdate { StatisticName = "rank", Value = 0 }); for (int i = 0; i < Gamemodes.gamemodes.Count; i++) { request.Statistics.Add(new PlayFab.ServerModels.StatisticUpdate { StatisticName = $"{Gamemodes.gamemodes[i].shortName}_kills", Value = 0 }); request.Statistics.Add(new PlayFab.ServerModels.StatisticUpdate { StatisticName = $"{Gamemodes.gamemodes[i].shortName}_deaths", Value = 0 }); request.Statistics.Add(new PlayFab.ServerModels.StatisticUpdate { StatisticName = $"{Gamemodes.gamemodes[i].shortName}_assists", Value = 0 }); request.Statistics.Add(new PlayFab.ServerModels.StatisticUpdate { StatisticName = $"{Gamemodes.gamemodes[i].shortName}_headshots", Value = 0 }); request.Statistics.Add(new PlayFab.ServerModels.StatisticUpdate { StatisticName = $"{Gamemodes.gamemodes[i].shortName}_wins", Value = 0 }); request.Statistics.Add(new PlayFab.ServerModels.StatisticUpdate { StatisticName = $"{Gamemodes.gamemodes[i].shortName}_losses", Value = 0 }); } log.LogInformation($"UpdatePlayerStatisticsAsync adding stats:{request.Statistics.Count}"); await server.UpdatePlayerStatisticsAsync(request);