Download

Does engine write to disk when we change variables inside SaveGame?

Hi guys!
I have some variables in my SaveGame that I’ll need to change very frequently.
It’ll be bad practice to write stuff to disk every 1sec or so.

Does engine write anything to disk if I just set variables inside my SaveGame (I don’t call SaveGameToSlot)?
Many thanks!

I don’t think it writes to any sort of non volatile storage unless you SaveGameToSlot. If your intention is to retrieve the changes written to the variable at a later time after an app restart, just setting the variable will not do it for you.

**Hrishi_A **is right, all that’s doing is setting the value on the save data object.

To actually make sure your changes are saved, you’ll need to use “Save Game To Slot” *after *you’ve set the variables.

Yeah I know that game won’t be saved if I don’t SaveGameToSlot in the end.
So if I just change variables there will be no problem with writing to disk too frequently?

The question here would be why you would want to save every time something changes? You could create an auto-save every few minutes which would be better IMO or simply let the player save when they want to save (or both). I’m sure you could make your own I/O thing to write to disk but I don’t think a game would benefit from this and I wouldn’t know how to do this myself.

What hedgie17 said ^^. You could also make a slider in the settings of your game to set an autosave interval.
Changing it every second would be bad practice imo.

It may or may not be.

I have hundreds of variables in my project. It would be much more convenient to just change them in SaveGame_reference.