Hi, I'm wanting to update x amount of statistics via unity and cloudscript.
Forgetting the callbacks, pseudo-code, this doesn't work. I want to be able to update any number of statistics in one call (within the limit) without knowing which statistics prior.
public void UpdatePlayerStatistics(string[] names, int[] values) { List<StatisticUpdate> myUpdate = new List<StatisticUpdate> { new StatisticUpdate { StatisticName=names[0], Value = value[0] }, new StatisticUpdate { StatisticName=names[1], Value = value[1] } }; ExecuteCloudScriptRequest request = new ExecuteCloudScriptRequest() { FunctionName = "UpdateStatisticData", FunctionParameter = new { data = myUpdate } }; }
handlers.UpdateStatisticData = function(args) { try { var dataPayload = args.data; var UpdatePlayerStatisticsRequest = { "PlayFabId": currentPlayerId, "Data": dataPayload } var result = server.UpdatePlayerStatistics( UpdatePlayerStatisticsRequest ); } catch(e) { var retObj = {}; retObj["errorDetails"] = "Error: " + e; log.info(e); return retObj; } }
Thank you