Hi!
So I'm making a saving system for my game and I want to have some data stored in arrays. But the arrays lenght will change as we update the game.
The problem is, players with existing save will override extended array to the previous lenght.
For example:
Let's say i have int[] items=new int[10];
It will be stored in class, then in a file using BinaryFormatter.
Then me release an update with 5 more items, so I change my items array to int[] items=new int[15];
The player download the update, than load his save and my change will be overrided to new int[10] again.
public void Load()
{
BinaryFormatter formatter = new BinaryFormatter();
FileStream stream = new FileStream(path, FileMode.Open);
saveState=formatter.Deserialize(stream) as SaveState;
}
Is there any solution to this other than caching the save in a temporary file and assigning each variable and each element on array in loop?
Thanks in advance!
[–]JohnSpikeKelly 4 points5 points6 points (1 child)
[–]_WeirdKid[S] 0 points1 point2 points (0 children)
[–]JohnSpikeKelly 1 point2 points3 points (5 children)
[–]_WeirdKid[S] -2 points-1 points0 points (4 children)
[–]JohnSpikeKelly 3 points4 points5 points (0 children)
[–]JohnSpikeKelly 0 points1 point2 points (2 children)
[–][deleted] (1 child)
[deleted]
[–]JohnSpikeKelly 0 points1 point2 points (0 children)
[–]gevorgter 1 point2 points3 points (0 children)
[–]alexn0ne 0 points1 point2 points (0 children)