We’re currently serializing and saving data for our game to a series of json files during play and also loading and deserializing at start-up/loading. The game is for PC & OSX, and we’re using the PersistentDataPath as the location for these files.
We perform these actions as synchronous functions, which can cause the game to lock up during play as it executes these read/write functions. We’ve had a couple of bug reports around corrupted json files and, though we ensure that the save data is secure by creating a backup before writing to them, it would be good to know what the cause is.
I’m wondering if the application freeze during this synchronous read/write could possibly be the cause? I’ve heard that file read/writes should be performed as asynchronous tasks on certain platforms and I’m wondering if going async might eliminate this issue for us.
What have people’e experiences been with file reading/writing and synchronous functions?