Inventory Engine v4.2
Loading...
Searching...
No Matches
MoreMountains.Tools.MMPersistent Class Reference

A persistent class that can save the essential parts of an object : its transform data (position, rotation, scale) and its active state This inherits from MMPersistentBase and implements the IMMPersistent interface It's a good example of how to implement the interface's OnSave and OnLoad methods. More...

Inherits MoreMountains.Tools.MMPersistentBase.

Classes

struct  ComponentData
struct  Data
 A struct used to store and serialize the data we want to save. More...

Public Member Functions

override string OnSave ()
 On Save, we turn the object's transform data and active state to a Json string and return it to the MMPersistencyManager.
override void OnLoad (string data)
 On load, we read the saved json data and apply it to our object's properties.
Public Member Functions inherited from MoreMountains.Tools.MMPersistentBase
virtual string GetGuid ()
 Returns the object's GUID.
virtual void SetGuid (string newGUID)
 Lets you set the object's GUID.
virtual bool ShouldBeSaved ()
 Lets the persistence manager know whether or not the object should be saved.
virtual string GenerateGuid ()
 Generates a unique ID for the object, using the scene name, the object name, and a GUID.
virtual bool GuidIsUnique (string guid)
 Checks if the object's ID is unique or not.
virtual void ValidateGuid ()
 Validates the object's GUID, and generates a new one if needed, until a unique one is found.

Public Attributes

bool SavePosition = true
 whether or not to save this object's position
bool SaveLocalRotation = true
 whether or not to save this object's rotation
bool SaveLocalScale = true
 whether or not to save this object's scale
bool SaveActiveState = true
 whether or not to save this object's active state
bool SaveEnabledStates = false
 whether or not to save this object's components' enabled states
Public Attributes inherited from MoreMountains.Tools.MMPersistentBase
bool SaveActive = true
 whether or not this object should be saved
string UniqueIDSuffix
 an optional suffix to add to the GUID, to make it more readable
bool GenerateGuidButton
 a debug button used to force a new GUI generation

Protected Member Functions

virtual List< ComponentDataGetCurrentComponents ()
 Grabs all components on this object.
Protected Member Functions inherited from MoreMountains.Tools.MMPersistentBase
virtual void OnValidate ()
 On validate, we make sure the object gets a valid GUID.

Additional Inherited Members

Protected Attributes inherited from MoreMountains.Tools.MMPersistentBase
string _guid
 the object's unique ID

Detailed Description

A persistent class that can save the essential parts of an object : its transform data (position, rotation, scale) and its active state This inherits from MMPersistentBase and implements the IMMPersistent interface It's a good example of how to implement the interface's OnSave and OnLoad methods.

Member Function Documentation

◆ GetCurrentComponents()

virtual List< ComponentData > MoreMountains.Tools.MMPersistent.GetCurrentComponents ( )
protectedvirtual

Grabs all components on this object.

◆ OnLoad()

override void MoreMountains.Tools.MMPersistent.OnLoad ( string data)
virtual

On load, we read the saved json data and apply it to our object's properties.

Parameters
data

Reimplemented from MoreMountains.Tools.MMPersistentBase.

◆ OnSave()

override string MoreMountains.Tools.MMPersistent.OnSave ( )
virtual

On Save, we turn the object's transform data and active state to a Json string and return it to the MMPersistencyManager.

Returns

Reimplemented from MoreMountains.Tools.MMPersistentBase.

Member Data Documentation

◆ SaveActiveState

bool MoreMountains.Tools.MMPersistent.SaveActiveState = true

whether or not to save this object's active state

◆ SaveEnabledStates

bool MoreMountains.Tools.MMPersistent.SaveEnabledStates = false

whether or not to save this object's components' enabled states

◆ SaveLocalRotation

bool MoreMountains.Tools.MMPersistent.SaveLocalRotation = true

whether or not to save this object's rotation

◆ SaveLocalScale

bool MoreMountains.Tools.MMPersistent.SaveLocalScale = true

whether or not to save this object's scale

◆ SavePosition

bool MoreMountains.Tools.MMPersistent.SavePosition = true

whether or not to save this object's position


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