Getting Started

After importing Easy Save from the Asset Store, you can immediately use Easy Save from your scripts and in PlayMaker.

For information on PlayMaker actions available, see the PlayMaker Actions Overview.

Easy Save stores data as keys and values, much like a Dictionary.

For example, to save an integer to a key named myInteger and load it back again, you could do:

C#

JS

If you’re unsure whether a key exists before loading, you can use ES3.KeyExists or specify the defaultValue parameter of the ES3.Load method.

C#

JS

To load a value into an existing object, use ES3.LoadInto.

C#

JS

To see what types are supported, see our Supported Types guide.

You can save and load anywhere you can run code, but typically it makes sense to load in Unity’s Start() routine, and save in Unity’s OnApplicationQuit() routine.

OnApplicationQuit() is not always called on mobile platforms, so OnApplicationPause(bool) should be used instead for these platforms.

C#

JS

You could also create a Save() and Load() method containing your save code, and link these to a save and load button.

More information on Unity’s event functions can be found in their Event Functions page.

The filePath parameter of ES3 methods lets you specify the file in which the data is saved.

If you only specify a filename, this will point to a file in the default file location. You can check whether a file exists using the ES3.FileExists method.

The file will be automatically created if it does not exist, and if saving a key which already exists in the file, that key will be overwritten.

It’s even possible to save and load a file from a sub-directory in the default save location, or an absolute path. For detailed information see the Paths and Locations guide.

C#

JS

C#

JS

You can supply an ES3Settings object as a parameter to most methods to enable options such as encryption. See the ES3Settings page for more information on the options available.

C#

Save data using an ES3Settings object to specify settings.

JS

Save data using an ES3Settings object to specify settings.