I'm trying to access data that I will eventually be passing into the objects.SetObjects() function to update my Entity Objects for a player.
However, whenever I'm trying to access 'Currency' or any proeprty in the object it returns null or an error.
{ "DataObject": { "Currency": 9545673828.105536, "WorldLastUpdateTime": 637548279843703300, "PerSecondIncome": 1279134.8219332695, "Generator_0": { "GeneratorLevel": 49, "IsManual": false, "OwningWorld": "PlayerData_World0", "Automate": 1, "Increase_Speed": 50, "Increase_Yield": 25 }, "Generator_1": { "GeneratorLevel": 329, "IsManual": false, "OwningWorld": "PlayerData_World0", "Automate": 1, "Increase_Speed": 20, "Increase_Yield": 25 } }, "DeleteObject": null, "EscapedDataObject": null, "ObjectName": "PlayerData_World0" }
Above is an example of the data I'm passing in, and what it looks like when I print the entire object. I'm attempting to access the 'Currency' property but I can't get it to work.
I've tried;
worldData.Currency
worldData["Currency"]
worldData["0"] (which just returns above)
worldData.DataObject
worldData.Objects
worldData["Objects"]
worldData["DataObject"]
I've also tried JSON.parse(worldData)
and JSON.parse(worldData.DataObject)
and JSON.parse(JSON.parse(worldData.DataObject))
and none of it seems to work. I feel like its a simple solution, but I'm not as familiar with js myself yet and couldn't find anything online.Easiest solution would be for me to pass the value I want in along with the args from Unity but I want to avoid that if possible since its essentially duplicating data.