Save problem after last update

Discussion and help for Easy Save 3
Post Reply
EVG
Posts: 12
Joined: Tue Dec 13, 2022 5:49 pm

Save problem after last update

Post by EVG »

Hello, after the last update, the saves do not work somehow correctly, the early saves interfere with the new ones even after deleting the old ones.
Here is an example:
1. I start a new game, while deleting the save file:

Code: Select all

ES3.DeleteFile(SaveManager.SaveDataFileName);
2. I save in the game:

Code: Select all

ES3File es3File = new ES3File(SaveDataFileName);
es3File.Clear();
ES3.CacheFile(SaveDataFileName);
var settings = new ES3Settings(SaveDataFileName, ES3.Location.Cache);
ES3.Save...
ES3.StoreCachedFile(SaveDataFileName);
3. I restart the game, load the previously saved data, everything is fine.
4. I decide to start a new game again, and thus delete the early saves:

Code: Select all

ES3.DeleteFile(SaveManager.SaveDataFileName);
5. Again I save in the game:

Code: Select all

ES3File es3File = new ES3File(SaveDataFileName);
es3File.Clear();
ES3.CacheFile(SaveDataFileName);
var settings = new ES3Settings(SaveDataFileName, ES3.Location.Cache);
ES3.Save...
ES3.StoreCachedFile(SaveDataFileName);
6. I leave the game, I go into it again. And now some of the new saves are loaded, and some of the old ones, everything is mixed incomprehensibly.

Why do old saves remain after deleting the ES3.DeleteFile file and clearing it before saving again with es3File.Clear()? Where did they come from if the file was deleted? Before the last update, this was not the case.
User avatar
Joel
Moodkie Staff
Posts: 4826
Joined: Wed Nov 07, 2012 10:32 pm

Re: Save problem after last update

Post by Joel »

Hi there,

You appear to be using ES3File, which is intentionally undocumented and should not be used as it is only used internally (and is subject to change between versions). You should exclusively use the Cache save location as documented here:

https://docs.moodkie.com/easy-save-3/es ... rformance/

If this doesn't resolve your issue please could you create a script which I can drop into a new scene in a new project which replicates your issue which doesn't use ES3File.

All the best,
Joel
Joel @ Moodkie Interactive
Purchase Easy Save | Contact | Guides | Docs | Getting started
EVG
Posts: 12
Joined: Tue Dec 13, 2022 5:49 pm

Re: Save problem after last update

Post by EVG »

Joel wrote: Tue Feb 07, 2023 2:35 pm You appear to be using ES3File, which is intentionally undocumented and should not be used as it is only used internally (and is subject to change between versions).
Is there no documentation about it?
Here: https://docs.moodkie.com/easy-save-3/es ... ile-clear/
If it cannot be used, then what is the correct way to clear all keys in the save file?
User avatar
Joel
Moodkie Staff
Posts: 4826
Joined: Wed Nov 07, 2012 10:32 pm

Re: Save problem after last update

Post by Joel »

Hi there,

We had a public version of ES3File, but this was removed quite a long time ago. Just to clarify, accessible classes are indicated on the API page:
https://docs.moodkie.com/product/easy-save-3/es3-api/

We removed the ES3File class from the API page, but it looks like it's individual pages are still accessible through Google as we didn't delete them. I've gone ahead and deleted them now.

The correct way to clear all keys in a save file is to delete the save file. However, if you are encountering issues and still want to use ES3File, you may be encountering a bug which I've just managed to replicate from another user. If you private message me your invoice number I can send the fix for this over.

All the best,
Joel
Joel @ Moodkie Interactive
Purchase Easy Save | Contact | Guides | Docs | Getting started
EVG
Posts: 12
Joined: Tue Dec 13, 2022 5:49 pm

Re: Save problem after last update

Post by EVG »

Unfortunately the updated file did not help. All the same, there are elements of the previous save.
Could it be caching? That is, I first cached something, saved the data, then deleted the save file, but the old cache still remained?
And am I working with the cache correctly?

Save:

Code: Select all

ES3.DeleteFile(SaveDataFileName);
var settings = new ES3Settings(SaveDataFileName, ES3.Location.Cache);
... ES3.Save("key", value, SaveDataFileName, settings); ...
ES3.StoreCachedFile(SaveDataFileName);
Load:

Code: Select all

ES3.CacheFile(SaveDataFileName);
var settings = new ES3Settings(SaveDataFileName, ES3.Location.Cache);
... value = ES3.Load<string>("key", SaveDataFileName, settings); ...
User avatar
Joel
Moodkie Staff
Posts: 4826
Joined: Wed Nov 07, 2012 10:32 pm

Re: Save problem after last update

Post by Joel »

Hi there,

Your ES3.DeleteFile call doesn't specify a location so it will use the default location (which is File unless you've changed this in the settings), meaning the file on disk will be deleted but not any locally cached data. Specifying the cache should resolve your issue. I.e.

Code: Select all

var settings = new ES3Settings(SaveDataFileName, ES3.Location.Cache)
ES3.DeleteFile(SaveDataFileName, settings);
... ES3.Save("key", value, SaveDataFileName, settings); ...
ES3.StoreCachedFile(SaveDataFileName);
All the best,
Joel
Joel @ Moodkie Interactive
Purchase Easy Save | Contact | Guides | Docs | Getting started
EVG
Posts: 12
Joined: Tue Dec 13, 2022 5:49 pm

Re: Save problem after last update

Post by EVG »

Joel wrote: Wed Feb 08, 2023 2:34 pm Hi there,

Your ES3.DeleteFile call doesn't specify a location so it will use the default location (which is File unless you've changed this in the settings), meaning the file on disk will be deleted but not any locally cached data. Specifying the cache should resolve your issue. I.e.

Code: Select all

var settings = new ES3Settings(SaveDataFileName, ES3.Location.Cache)
ES3.DeleteFile(SaveDataFileName, settings);
... ES3.Save("key", value, SaveDataFileName, settings); ...
ES3.StoreCachedFile(SaveDataFileName);
All the best,
Joel
This helped, thanks! And another question, do I need to specify settings in ES3.StoreCachedFile? That is, which option would be correct in my case
This one: ES3.StoreCachedFile(SaveDataFileName);
Or this one: ES3.StoreCachedFile(SaveDataFileName, settings);?
User avatar
Joel
Moodkie Staff
Posts: 4826
Joined: Wed Nov 07, 2012 10:32 pm

Re: Save problem after last update

Post by Joel »

Glad that's working for you now.

In your case you don't need to specify the location for ES3.StoreCachedFile because you're storing the cached file to ES3.Location.File, which is the default location.

However, if you wanted to store the cached file to ES3.Location.PlayerPrefs and the default location was set to ES3.Location.File in the settings, you would need to specify that you wanted to save to ES3.Location.PlayerPrefs.

Also note that there is no harm in providing ES3.Location.Cache as the save location in your case as it will use the default save location in this case.

All the best,
Joel
Joel @ Moodkie Interactive
Purchase Easy Save | Contact | Guides | Docs | Getting started
EVG
Posts: 12
Joined: Tue Dec 13, 2022 5:49 pm

Re: Save problem after last update

Post by EVG »

Thanks for the help!
Post Reply