Code-free using Auto Save
For information on saving and loading GameObjects without code, please see the Auto Save guide.
Saving and loading GameObjects
Your scene must have an Easy Save 3 Manager to save and load GameObjects. To add this to your scene, go to Assets > Easy Save 3 > Add Manager to Scene.
Once you have done this, GameObjects can be saved and loaded like any other object:
// Save a GameObject.
// Load a GameObject, automatically assigning it to an existing
// GameObject if one exists, or create a new GameObject if not.
This will save and load the following:
- layer, tag, name and hideFlags.
- Components on the Natively-supported types list, or those which have been manually supported using an ES3Type OR …
- … if the GameObject has an ES3GameObject Component, only the Components selected will be saved (see the Choosing which Components are saved section below).
- All of the above for every child of the GameObject.
Saving and loading prefab instances
To save and load a prefab instance:
- Right-click the prefab and select Enable Easy Save for Prefab.
- Use ES3.Save to save the instance, or an array of instances if you have multiple instances.
- To load, use ES3.Load or ES3.LoadInto.
- Easy Save will create an instance of the prefab if it doesn’t exist in the scene.
Choosing which Components are saved
You can choose which Components are saved by adding an ES3GameObject Component to the GameObject and checking which Components you wish to be saved.
Note that checking a Component doesn’t guarantee that it or it’s fields are serializable at runtime. It is recommended to only check Components which need to be saved, and which are known to be serializable. For example in most cases you shouldn’t check the ES3Prefab, ES3AutoSave or ES3GameObject Components, and doing so can cause errors.