So i have a some project with genre management and i want to save the progress every frame. But when i try it. it’s really slow performance the game. Then i try to use coroutine and save it every 0.5 seconds. Although the performance increased it’s still really slow.
I use file-based system. so i serialize class to file and saved it on application persistentDataPath.
Or maybe you guys can share other method should i use for auto save like this.
How much data are you saving? Can you separate it into multiple smaller files and only save the part that changed? Also, what are you using to serialize the class?
I use BinaryFormatter for serialize it. For data, i think it’s pretty big (Player position, inventory, Customer Position, Weather, Date, Events). It’s like last state on the game.
Well, I don’t really know why you need to save it all every frame. That’s pretty intense. If you really need to save it that often for some reason, you should still try to break it up into parts and only save what you need to when it needs to be saved. Example, does your weather really change every frame? Does your inventory change every frame?
It’s just not practical to do this between serializing the data and then writing it out, you’ll suffer on performance.