Settings, paths and locations
Changing settings
Changing settings at runtime
Create a new ES3Settings object, change it’s variables (if necessary), and provide it as a parameter to your method calls to override the default settings at runtime.
For information on what settings are available, see the ES3Settings page.
1 2 3 4 |
var settings = new ES3Settings(ES3.EncryptionType.AES, myPassword); settings.saveLocation = ES3.Location.PlayerPrefs; ES3.Save("myTransform", this.transform, settings); |
Changing default settings at runtime
The default settings can be changed by going to Window > Easy Save 3 and opening the Settings tab.
You can also change the default settings at runtime:
1 |
ES3Settings.defaultSettings.path = "MyNewFile.es3"; |
Paths
Relative Paths
Relative paths are relative to the storage location (see Storage locations below).
1 2 3 4 5 |
// Save a value to a file named "myFile.es3" in the default save location. ES3.Save("myKey", myValue, "myFile.es3"); /* Save a value to a file named "myFile.es3" in a sub-directory of the default save location */ ES3.Save("myKey", myValue, "myFolder/myFile.es3"); |
Absolute Paths
Absolute paths are also accepted. However, it is not recommended to use absolute paths unless you are certain the location will exist for all users at runtime and has the required permissions.
If you need to get an absolute path to a special folder at runtime, you can use .NET’s Environment.GetFolderPath method.
1 2 |
// Save a value to a file in an absolute folder. ES3.Save("myKey", myValue, "C:/Users/User/Documents/myFile.es3"); |
Storage locations
You can specify the storage location in Window > Easy Save 3 > Settings, or by providing an ES3Settings object as a parameter.
1 |
ES3.Save("myKey", myValue, new ES3Settings(ES3.Location.Cache) ); |
File
The default file directory is Unity’s Application.persistentDataPath, which you can find by going to Window > Easy Save 3 > Tools > Open Persistent Data Path.
File is not supported on WebGL and tvOS, and will automatically default to PlayerPrefs regardless of what the location is set to.
PlayerPrefs
Stores data in PlayerPrefs, which usually stores data in the registry or Isolated Storage. This is the default save location for platforms which don’t support File.
Resources
For information on the Resources location, see the Saving and Loading from Resources guide.
Cache
For more information, see the Improving Performance guide.