PixelCrushers.DestructibleSaver Class Reference

Saves when a GameObject has been destroyed or disabled. More...

Inheritance diagram for PixelCrushers.DestructibleSaver:
Collaboration diagram for PixelCrushers.DestructibleSaver:

Classes

class  DestructibleData
 

Public Types

enum  Mode { Mode.OnDisable, Mode.OnDestroy }
 
enum  DestroyMode { DestroyMode.Destroy, DestroyMode.Deactivate }
 

Public Member Functions

override void OnBeforeSceneChange ()
 The Save System will call this method before scene changes. More...
 
override void OnDisable ()
 
override void OnDestroy ()
 
override string RecordData ()
 This method should return a string that represents the data you want to save. More...
 
override 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...
 
- Public Member Functions inherited from PixelCrushers.Saver
virtual void Awake ()
 
virtual void Start ()
 
virtual void Reset ()
 
virtual void OnEnable ()
 

Protected Member Functions

virtual void RecordDestruction ()
 

Properties

Mode mode [get, set]
 
DestroyMode destroyMode [get, set]
 
GameObject destroyedVersionPrefab [get, set]
 
- Properties inherited from PixelCrushers.Saver
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...
 

Additional Inherited Members

- Protected Attributes inherited from PixelCrushers.Saver
string m_runtimeKey = null
 

Detailed Description

Saves when a GameObject has been destroyed or disabled.

The next time the game or scene is loaded, if the GameObject has previously been destroyed/disabled, this script will destroy/deactivate it again. It will also spawn a replacement destroyed version if a prefab is assigned.

Member Enumeration Documentation

Enumerator
Destroy 
Deactivate 
Enumerator
OnDisable 
OnDestroy 

Member Function Documentation

override void PixelCrushers.DestructibleSaver.ApplyData ( string  s)
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.

Implements PixelCrushers.Saver.

override void PixelCrushers.DestructibleSaver.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 from PixelCrushers.Saver.

override void PixelCrushers.DestructibleSaver.OnDestroy ( )
virtual

Reimplemented from PixelCrushers.Saver.

override void PixelCrushers.DestructibleSaver.OnDisable ( )
virtual

Reimplemented from PixelCrushers.Saver.

override string PixelCrushers.DestructibleSaver.RecordData ( )
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.

Implements PixelCrushers.Saver.

virtual void PixelCrushers.DestructibleSaver.RecordDestruction ( )
protectedvirtual

Property Documentation

GameObject PixelCrushers.DestructibleSaver.destroyedVersionPrefab
getset
DestroyMode PixelCrushers.DestructibleSaver.destroyMode
getset
Mode PixelCrushers.DestructibleSaver.mode
getset

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