PixelCrushers.Saver Class Referenceabstract

Abstract base class for a "saver", which is a component that contributes to saved game data. More...

Inheritance diagram for PixelCrushers.Saver:
Collaboration diagram for PixelCrushers.Saver:

Public Member Functions

virtual void Awake ()
 
virtual void Start ()
 
virtual void Reset ()
 
virtual void OnEnable ()
 
virtual void OnDisable ()
 
virtual void OnDestroy ()
 
abstract string RecordData ()
 This method should return a string that represents the data you want to save. More...
 
abstract void ApplyData (string s)
 This method should process the string representation of saved data and apply it to the current state of the game. More...
 
virtual void OnBeforeSceneChange ()
 The Save System will call this method before scene changes. More...
 

Protected Attributes

string m_runtimeKey = null
 

Properties

bool appendSaverTypeToKey [get, set]
 Append the name of this saver type to the key. More...
 
virtual string key [get, set]
 Save data under this key. More...
 
string _internalKeyValue [get, set]
 Accesses the internal key value. More...
 
virtual bool saveAcrossSceneChanges [get, set]
 Save when changing scenes to be able to restore saved state when returning to scene. More...
 

Detailed Description

Abstract base class for a "saver", which is a component that contributes to saved game data.

Member Function Documentation

abstract void PixelCrushers.Saver.ApplyData ( string  s)
pure virtual

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.

Implemented in PixelCrushers.AnimatorSaver, PixelCrushers.DestructibleSaver, PixelCrushers.SpawnedObjectManager, PixelCrushers.SpawnedObject, PixelCrushers.ActiveSaver, PixelCrushers.EnabledSaver, PixelCrushers.PositionSaver, and PixelCrushers.DialogueSystem.DialogueSystemSaver.

virtual void PixelCrushers.Saver.Awake ( )
virtual
virtual void PixelCrushers.Saver.OnBeforeSceneChange ( )
virtual

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, PixelCrushers.SpawnedObject, and PixelCrushers.DialogueSystem.DialogueSystemSaver.

virtual void PixelCrushers.Saver.OnDestroy ( )
virtual
virtual void PixelCrushers.Saver.OnDisable ( )
virtual
virtual void PixelCrushers.Saver.OnEnable ( )
virtual
abstract string PixelCrushers.Saver.RecordData ( )
pure virtual

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.

Implemented in PixelCrushers.DestructibleSaver, PixelCrushers.SpawnedObjectManager, PixelCrushers.SpawnedObject, PixelCrushers.AnimatorSaver, PixelCrushers.ActiveSaver, PixelCrushers.EnabledSaver, PixelCrushers.PositionSaver, and PixelCrushers.DialogueSystem.DialogueSystemSaver.

virtual void PixelCrushers.Saver.Reset ( )
virtual
virtual void PixelCrushers.Saver.Start ( )
virtual

Reimplemented in PixelCrushers.SpawnedObject.

Member Data Documentation

string PixelCrushers.Saver.m_runtimeKey = null
protected

Property Documentation

string PixelCrushers.Saver._internalKeyValue
getset

Accesses the internal key value.

Normally leave this untouched and access the key property instead.

bool PixelCrushers.Saver.appendSaverTypeToKey
getset

Append the name of this saver type to the key.

virtual string PixelCrushers.Saver.key
getset

Save data under this key.

If blank, use GameObject name.

virtual bool PixelCrushers.Saver.saveAcrossSceneChanges
getset

Save when changing scenes to be able to restore saved state when returning to scene.


The documentation for this class was generated from the following file: