Page 1 of 1

Strange issue: Saving does not work when re-save

Posted: Tue Jan 09, 2024 12:31 pm
by ParadizzZ
Hello, I have encountered the following problem when using the plugin. If the save file is not created or if I quit playmode and enter playmode again, the save works. If I try to make a save again during playmod or if I try to make it after loading a save, the data in the file is not updated. There are no errors in the logs.

Please tell me what could be the problem?

Here's test code:

Code: Select all

 public static void GetGameSaveDataForUI(int gameSaveId)
 {
     ES3AutoSaveMgr.Current.settings.path = gameSaveId + ".es3";
     ES3Settings.defaultSettings.path = gameSaveId + ".es3"; //Обязательно это использовать иначе создает 2 файла
     GameSavesCountOnFileUI = ES3.Load<int>("GameSavesCountOnFile", 0);
     GameSaveFileNameUI = ES3.Load<int>("GameSaveFileName", 0);
     currentDateTimeUI = ES3.Load<DateTime>("currentDateTime", DateTime.Now);
     totalTimePlayedUI = ES3.Load<float>("totalTimePlayed", 0);
     if (ES3.KeyExists("CurrentLevelName"))
         CurrentLevelNameUI = ES3.Load<string>("CurrentLevelName");

     CheckPlayTimeAndmakeFormat();
 }


 public static void SaveGame(int gameSaveId)
 {
     ES3AutoSaveMgr.Current.settings.path = gameSaveId + ".es3";
     ES3Settings.defaultSettings.path = gameSaveId + ".es3";

     GameSavesCountOnFile = ES3.Load<int>("GameSavesCountOnFile", 0);
     GameSavesCountOnFile++;
     ES3.Save("GameSaveFileName", gameSaveId);
     ES3.Save("GameSavesCountOnFile", GameSavesCountOnFile);
     currentDateTime = DateTime.Now;
     ES3.Save("currentDateTime", currentDateTime);
     ES3.Save("totalTimePlayed", totalTimePlayed);
     GetLevelName();
     ES3.Save("CurrentLevelName", CurrentLevelName);
     ES3AutoSaveMgr.Current.Save();
     Debug.Log("Global save started");
 }

 public static void LoadGame(int gameSaveId)
 {
     ES3AutoSaveMgr.Current.settings.path = gameSaveId + ".es3";
     ES3Settings.defaultSettings.path = gameSaveId + ".es3";
     GameSaveFileName = ES3.Load<int>("GameSaveFileName", 0);
     GameSavesCountOnFile = ES3.Load<int>("GameSavesCountOnFile", 0);
     currentDateTime = ES3.Load<DateTime>("currentDateTime", DateTime.Now);
     totalTimePlayed = ES3.Load<float>("totalTimePlayed", 0);
     ES3AutoSaveMgr.Current.Load();
 }

Re: Strange issue: Saving does not work when re-save

Posted: Wed Jan 10, 2024 9:20 am
by Joel
Hi there,

Please could you explain how you're checking that the data in the file is not updated?

All the best,
Joel

Re: Strange issue: Saving does not work when re-save

Posted: Wed Jan 10, 2024 10:25 am
by ParadizzZ
Joel wrote: Wed Jan 10, 2024 9:20 am Hi there,

Please could you explain how you're checking that the data in the file is not updated?

All the best,
Joel
Hi, Joel!
Thanks for reply.

I check by looking at the data in the Json save file. The problem was partially solved by separating the manual save and auto save methods. But part of the manual save data is still not updated in the save file.

Re: Strange issue: Saving does not work when re-save

Posted: Wed Jan 10, 2024 11:01 am
by Joel
You should first check that the Save and Load event are set to None in the Auto Save panel. If this doesn't resolve your issue, and as I've had no other reports of this behaviour, please could you replicate this in a new project with a simple scene and send me a link to it on moodkie.com/contact along with instructions.

All the best,
Joel