UnityToolbox
Brief documentation for all existing scripts.
 
Loading...
Searching...
No Matches
Saveable Class Referenceabstract

The base implementation for all gameobjects that should be saved. It is able to serialize the transform and parent data with the SaveGameManager. Requires a PrefabManager and aIDManager, if the objects are not initially found in the scene.

Inheritance diagram for Saveable:
UnityToolbox.Item.ItemInstance

Public Member Functions

void Save ()
 Defines all data to be serialized by the SaveGameManager.
 
void Load ()
 Loads all data, deserialized by the SaveGameManager.
 
void OnValidate ()
 

Public Attributes

ResourceData PrefabData
 The date which is used to serialize a reference to the Prefab.
 

Protected Member Functions

abstract void LoadData (GameData data)
 Is called after the base data is loaded in Load. Allows additional data to be deserialized.
 
abstract List< GameDataSaveData ()
 Is called on Save. Allows the definition of all additional GameData to be serialized.
 
abstract void OnObjectDeleted ()
 A method called on deletion, that is that the object is removed from the save game and destroyed. It is not called when destroyed but saved.
 

Protected Attributes

bool _removeFromSaveOnDelete
 

Properties

string ID [get, set]
 A unique ID.
 
bool InEditor [get]
 Whether the gameobject is found in the scene initally. Or created dynamically.
 

Member Function Documentation

◆ Load()

◆ LoadData()

abstract void Saveable.LoadData ( GameData  data)
protectedpure virtual
Parameters
dataA GameData implementation, which holds data to load.

Implemented in UnityToolbox.Item.ItemInstance.

Referenced by Load().

◆ OnObjectDeleted()

abstract void Saveable.OnObjectDeleted ( )
protectedpure virtual

◆ OnValidate()

void Saveable.OnValidate ( )

◆ Save()

void Saveable.Save ( )

References ID, InEditor, PrefabData, and SaveData().

◆ SaveData()

abstract List< GameData > Saveable.SaveData ( )
protectedpure virtual
Returns

Implemented in UnityToolbox.Item.ItemInstance.

Referenced by Save().

Member Data Documentation

◆ _removeFromSaveOnDelete

bool Saveable._removeFromSaveOnDelete
protected

◆ PrefabData

ResourceData Saveable.PrefabData

Referenced by Save().

Property Documentation

◆ ID

string Saveable.ID
getset

Referenced by Load(), Save(), and IDManager.SceneChanged().

◆ InEditor

bool Saveable.InEditor
get

Referenced by Save().