Auto Save
The auto save feature allows you to save and load data without using the programatic interface.
Check the Using Auto Save guide to learn more about the Auto Save feature.
Auto Save Manager Window
You can open up the Auto Save Manager Window through the Window > Bayat > Save System > Auto Save Manager menu:
This window lets you manage Auto Save system in your scene through a single place that provides an easy way to add / remove components and children for serialization and also lets you add / remove Auto Save components from game objects in the scene.
Once you add the Auto Save component to an object or that object already have one, the window will display the Auto Save component information on the right pane:
That lets you modify them more easily.
Auto Save Manager Component
The Auto Save Manager component holds a list of all the Auto Save components available in the scene, so you can save the GameObjects with Auto Save copmponent easily by calling the Save method on Auto Save Manager or use save event to do it at specific time, such as OnApplicationQuit, OnApplicationPause, OnDisable or OnDestroy and then load it back by calling Load manually or using an event like Start, Awake or OnEnable.
- Identifier: The storage item identifier to store the data into, it can be a file name or a key.
- Settings Preset: The settings preset to use.
- Auto Saves: The auto saves available in the scene.
- Event Types: The event used to save the data.
- Manual: Manually call the Save or the Load method on Auto Save Manager to save / load the data.
- OnEnable: Uses the Unity OnEnable event function
- Start: Uses the Unity Start event function
- Awake: Uses the Unity Awake event function
- OnDisable: Uses the Unity OnDisable event function
- OnDestroy: Uses the Unity OnDestroy event function
- OnApplicationQuit: Uses the Unity OnApplicationQuit event function
- OnApplicationPause: Uses the Unity OnApplicationPause event function
- OnSceneLoaded: Uses the Unity SceneManager.sceneLoaded event
- OnSceneUnloaded: Uses the Unity SceneManager.sceneUnloaded event
Note
Becase the game or app can be terminated directly by the user on Mobile devices, none of these end of lifecycle events will be fired by Unity such as OnDisable, OnDestroy, OnApplicationQuit, so the OnApplicationPause is the most reliable one on Mobile devices
Learn more about these events at Unity - Manual: Order of execution for event functions article.
Auto Save Component
Tha auto save component allows you to control the serialization behaviour of a GameObject, such as serializing components or children, excluding specific children or components.
- Serialize Children: Enables serialization of the GameObject children.
- Serialize Components: Enables serialization of the GameObject components.
- Serialize Excluded Children: Inverts the serialization of the GameObject children using the Excluded Children list that means instead of excluding them, it will only serialize the children that are included in the list.
- Serialize Excluded Components: Inverts the serialization of the GameObject components using the Excluded Components list that means instead of excluding them, it will only serialize the components that are included in the list.
- Excluded Children: The list of excluded children, if the Serialize Excluded Children option is not set, it prevents the children in this list from being serialized, otherwise it'll only serialize the children included in this list.
- Excluded Components: The list of excluded components, if the Serialize Excluded Components option is not set, it prevents the components in this list from being serialized, otherwise it'll only serialize the components included in this list.
Note
The Auto Save component extends the GameObject Serialization Handler component.