Forum rules - please read before posting.

Autosave action saves game multiple times

I've made an action that autosaves my game at certain points in the game, and it works fine. However, I see in the log that the game saves/writes to disk multiple times in a row, which is an issue for certain consoles that have limits on the amount of write access per minute. The action is called only once.

This is the action:

This is the log:

When testing manual saving, it appears to be three writes per game which is ok. I am using json and SaveFileHandler_PlayerPrefs.cs to save games. Is there anything I can change on my end to make sure the game doesn't write more than it has to?

Unity 2018.4/Win10/Latest AC


  • edited June 2020

    I have a call to AC.GlobalVariables.SetStringValue(32, timeSaved);
    in my custom action, just removing that took away one write access. Am I correct in assuming that setting a globalvariable automatically writes to disk?

    I also do a Rename Save, and removing that one took away another disk write. (I get the current time and renames the save file to that, will try to find a workaround for that, probably a stupid thing to do :D )

  • edited June 2020

    This likely isn't a case of multiple saves being written, but rather a single save being updated.

    Is Global Variable "32" linked to Options Data? If so, changing it's value will cause it to become saved - since it's value is part of the profile data, and not part of the save file.

    If the Save: Save or load Action is set to Overwrite Existing Save, you can set it's label at that time - rather than renaming it afterwards. If you want to configure the name of "Autosave", you can implement a duplicate / subclass of SaveFileHandler_PlayerPrefs with a modified GetDefaultSaveLabel function.

  • Thanks, this was helpful! I had linked the Global Variable to Options Data, but I realised I did not need to. Now it's down to four write accesses, and if I can make a workaround as you outlined for the Autosave name in a duplicate SaveFileHandler I should be safe.

    Just a quick question, would setting a custom name with / and : create any problems? When checking the save data after renaming a save to the string it still shows up as "autosave" in the Manage save-game files window (but shows up correctly in the LoadList), so perhaps (hopefully) it's not the actual file that is renamed?

  • You should be OK. A Save's filename, and it's label, are separate.

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Welcome to the official forum for Adventure Creator.