Abstract base class for a "saver", which is a component that contributes to saved game data. More...
Public Member Functions | |
virtual void | Awake () |
virtual void | Start () |
virtual void | Reset () |
virtual void | OnEnable () |
virtual void | OnDisable () |
virtual void | OnDestroy () |
string | RecordData () |
This method should return a string that represents the data you want to save. | |
void | ApplyData (string s) |
This method should process the string representation of saved data and apply it to the current state of the game. | |
virtual void | ApplyDataImmediate () |
If the Saver needs to pull data from the Save System immediately after loading a scene, instead of waiting for ApplyData to be called at it its normal time, it can implement this method. | |
virtual void | OnBeforeSceneChange () |
The Save System will call this method before scene changes. | |
virtual void | OnRestartGame () |
The Save System will call this method when restarting the game. | |
Protected Attributes | |
string | m_runtimeKey = null |
Properties | |
bool | appendSaverTypeToKey [get, set] |
Append the name of this saver type to the key. | |
virtual string | key [get, set] |
Save data under this key. | |
string | _internalKeyValue [get, set] |
Accesses the internal key value. | |
virtual bool | saveAcrossSceneChanges [get, set] |
Save when changing scenes to be able to restore saved state when returning to scene. | |
virtual bool | restoreStateOnStart [get, set] |
Abstract base class for a "saver", which is a component that contributes to saved game data.
|
abstract |
This method should process the string representation of saved data and apply it to the current state of the game.
You can use SaveSystem.Deserialize() to deserialize the string to an object that specifies the state to apply to the game.
|
inlinevirtual |
If the Saver needs to pull data from the Save System immediately after loading a scene, instead of waiting for ApplyData to be called at it its normal time, it can implement this method.
For efficiency, the Save System will not look up the Saver's data; your method must look it up manually by calling SaveSystem.savedGameData.GetData(key).
|
inlinevirtual |
|
inlinevirtual |
The Save System will call this method before scene changes.
If your saver listens for OnDisable or OnDestroy messages (see DestructibleSaver for example), it can use this method to ignore the next OnDisable or OnDestroy message since they will be called because the entire scene is being unloaded.
Reimplemented in PixelCrushers.DestructibleSaver, and PixelCrushers.SpawnedObject.
|
inlinevirtual |
Reimplemented in PixelCrushers.DestructibleSaver, and PixelCrushers.SpawnedObject.
|
inlinevirtual |
Reimplemented in PixelCrushers.DestructibleSaver, and PixelCrushers.SpawnedObject.
|
inlinevirtual |
|
inlinevirtual |
The Save System will call this method when restarting the game.
Your saver can reset data to a fresh state if necessary.
|
abstract |
This method should return a string that represents the data you want to save.
You can use SaveSystem.Serialize() to serialize a serializable object to a string. This will use the serializer component on the Save System GameObject, which defaults to JSON serialization.
|
inlinevirtual |
Reimplemented in PixelCrushers.SpawnedObjectManager.
|
inlinevirtual |
Reimplemented in PixelCrushers.SpawnedObject.
|
protected |
|
getset |
Accesses the internal key value.
Normally leave this untouched and access the key property instead.
|
getset |
Append the name of this saver type to the key.
|
getset |
Save data under this key.
If blank, use GameObject name.
|
getset |
|
getset |
Save when changing scenes to be able to restore saved state when returning to scene.