question

td0239 avatar image
td0239 asked

How to save an int array of fixed size in WhisperSync

I am using WhisperSync in my game, it works well across different data types, however I'm not sure what to do to save/load and int array of fixed size I've looked at SyncableNumberList, but as far as I can see you can only add more numbers to the list, you can't set values at certain indexes. I don't wan't to add more and more values, I just want to be able to update values at all indexes e.g values[0] = 10. Please could you advise on the best way to achieve this?
10 |5000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

1 Answer

Sujoy@Amazon avatar image
Sujoy@Amazon answered
You can serialize the array into a SynchableString and then deserialize it from syncing from the cloud or to create a GameDataMap and then have a fixed number of SyncableNumbers within that map as the only elements in that container. Alternatively you could instantiate N syncable numbers to represent each element in the array.
10 |5000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.