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

A base class implementing the IMMPersistent interface, designed to be extended This mostly takes care of the GUID generation and validation. More...

Inherits MonoBehaviour, and MoreMountains.Tools.IMMPersistent.

Inherited by MoreMountains.Tools.MMPersistent.

Public Member Functions

virtual string GetGuid ()
 Returns the object's GUID.
virtual void SetGuid (string newGUID)
 Lets you set the object's GUID.
virtual string OnSave ()
 On save, does nothing, meant to be extended.
virtual void OnLoad (string data)
 On load, does nothing, meant to be extended.
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 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 void OnValidate ()
 On validate, we make sure the object gets a valid GUID.

Protected Attributes

string _guid
 the object's unique ID

Detailed Description

A base class implementing the IMMPersistent interface, designed to be extended This mostly takes care of the GUID generation and validation.

Member Function Documentation

◆ GenerateGuid()

virtual string MoreMountains.Tools.MMPersistentBase.GenerateGuid ( )
virtual

Generates a unique ID for the object, using the scene name, the object name, and a GUID.

Returns

◆ GetGuid()

virtual string MoreMountains.Tools.MMPersistentBase.GetGuid ( )
virtual

Returns the object's GUID.

Returns

Implements MoreMountains.Tools.IMMPersistent.

◆ GuidIsUnique()

virtual bool MoreMountains.Tools.MMPersistentBase.GuidIsUnique ( string guid)
virtual

Checks if the object's ID is unique or not.

Parameters
guid
Returns

◆ OnLoad()

virtual void MoreMountains.Tools.MMPersistentBase.OnLoad ( string data)
virtual

On load, does nothing, meant to be extended.

Parameters
data

Implements MoreMountains.Tools.IMMPersistent.

Reimplemented in MoreMountains.Tools.MMPersistent.

◆ OnSave()

virtual string MoreMountains.Tools.MMPersistentBase.OnSave ( )
virtual

On save, does nothing, meant to be extended.

Returns

Implements MoreMountains.Tools.IMMPersistent.

Reimplemented in MoreMountains.Tools.MMPersistent.

◆ OnValidate()

virtual void MoreMountains.Tools.MMPersistentBase.OnValidate ( )
protectedvirtual

On validate, we make sure the object gets a valid GUID.

◆ SetGuid()

virtual void MoreMountains.Tools.MMPersistentBase.SetGuid ( string newGUID)
virtual

Lets you set the object's GUID.

Parameters
newGUID

◆ ShouldBeSaved()

virtual bool MoreMountains.Tools.MMPersistentBase.ShouldBeSaved ( )
virtual

Lets the persistence manager know whether or not the object should be saved.

Returns

Implements MoreMountains.Tools.IMMPersistent.

◆ ValidateGuid()

virtual void MoreMountains.Tools.MMPersistentBase.ValidateGuid ( )
virtual

Validates the object's GUID, and generates a new one if needed, until a unique one is found.

Member Data Documentation

◆ _guid

string MoreMountains.Tools.MMPersistentBase._guid
protected

the object's unique ID

◆ GenerateGuidButton

bool MoreMountains.Tools.MMPersistentBase.GenerateGuidButton

a debug button used to force a new GUI generation

◆ SaveActive

bool MoreMountains.Tools.MMPersistentBase.SaveActive = true

whether or not this object should be saved

◆ UniqueIDSuffix

string MoreMountains.Tools.MMPersistentBase.UniqueIDSuffix

an optional suffix to add to the GUID, to make it more readable


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