Question

I've made an update to my game in which the save file has been updated, including an array. The problem I have is that the old save file doesn't have this array, so when the code tries to access it it gets an outofbounds error. The obvious solution would be to delete the save file and let the game recreate it, but that would result in the deletion of highscores. I have added a method in the save class but it seems to have no effect, as the original didn't have it.

Is there any way of updating the save file without deleting the data within? Another option might be to create another save file, but it would be tedious to create a new one for every update.

Any help or advice would be greatly appreciated.

Was it helpful?

Solution

Thinking loudly maybe read data from file to the memory, clear data inside file, add missing array to previous file's content and write stream again to the same file?

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top