Saving and loading from Resources
Resources allows you to include and load files which will be included at runtime, including Easy Save 3 save files.
Loading from Resources
To load from Resources, you must set the location to Resources in the default settings, or by using an ES3Settings object.
The file must have the extension .bytes to be able to load it from Resources.
// Create an ES3Settings object to set the storage location to Resources.
var settings = new ES3Settings();
settings.location = ES3.Location.Resources;
// Load from a file called "myFile.bytes" in Resources.
var myValue = ES3.Load<Vector3>("myKey", "myFile.bytes", settings);
// Load from a file called "myFile.bytes" in a subfolder of Resources.
var myValue = ES3.Load<Vector3>("myKey", "myFolder/myFile.bytes");
Saving to Resources
It’s not possible to modify the Resources folder at runtime as Unity compiles it into a package, but can be saved to in the Editor.
If you want to save data to Resources with the intention of loading later, the file must end in the extension .bytes.
To save directly to Resources you can use Application.dataPath + "/Resources/" to get the path. However, you will need exit Play mode and call AssetDatabase.Refresh() or manually refresh your project to be able to load from that file.
Alternatively, you can save data to a folder of your choice and then drag it into the Resources folder.
ES3.Save<int>("myKey", 123, Application.dataPath+"/Resources/myFile.bytes");