top of page

ProSaveMonoBehaviour

A class that can be set as a singleton and is effective at saving and loading data. A good class to use for managing game data.

Static Properties

Data

The global instance for this singleton implementation.

Fields

addToSave

Determines whether or not this class should be added to the save.

callCompleteScenePrep

Determines whether or not this class should call the CompleteScenePrep() function.

Determines the conditions when a load should be attempted from the drive / server.

destroyOnLoad

Determines if and when this object will be destroyed after new scenes are loaded.

Determines whether or not this class should be added to initialization.

includeInLateInitialization

Determines whether or not this class should be added to late initialization.

initializationWeight

Determines the order in which a particular object should be called during initialization. Lower numbers occur first.

lateInitializeWeight

Determines the order in which a particular object should be called during late initialization. Lower numbers occur first. It is best practice to have LateInitialize weight set to a number greater than 0.

loadGameWeight

Determines the order in which a particular object is loaded during loading. Lower numbers occur first.

makeSingleton

If true sets this as a singleton.

saveGameWeight

Determines the order in which a particular object is saved during saving. Lower numbers occur first.

scenesToDestoryOn

The scenes which, when loaded, will cause this object to be destroyed. This is only relevant when DestoryOnLoadOptions is set to DestroyOnSpecificLoads.

Properties

AddToSave

Determines whether or not this class should be added to the save.

CallCompleteScenePrep

Determines whether or not this class should call the CompleteScenePrep() function.

Determines whether or not this class can host initialization, late initialization, save/load and other ProSaver operations.

Determines whether or not this class should be added to initialization.

IncludeInLateInitialization

Determines whether or not this class should be added to late initialization.

InitializationWeight

Determine the order in which a particular object should be called during initialization. Lower numbers occur first.

int InitializationWeight { get => initializationWeight; set => initializationWeight = value; }

LateInitializationWeight

Determines the order in which a particular object should be called during late initialization. Lower numbers occur first. It is best practice to have LateInitialize weight set to a number greater than 0.

LoadGameWeight

Determines the order in which a particular object is loaded during loading. Lower numbers occur first.

MyInstance

The specific instance of the object. When implementing write MyInstance => this;

SaveGameWeight

Determines the order in which a particular object is saved during saving. Lower numbers occur first.

Methods

Sets this object as a singleton if makeSingleton == true. Sets this object to not be destroyed on load, or destroys it, depending on what destroyOnLoad is set to. Adds this to initialization if CallInitialize == true, to LateInitialize if CallLateInitialize == true, to Save and Load if AddToSave == true, and to CompleteScenePrep if CallCompleteScenePrep == true. Also, declares Initialization if not already declared.

CompleteScenePrep

This function is called when all scene initialization and late initializations are completed. Note that all classes that implement this call it on the same frame, so be wary of throttling.

The function that is called during initialization. Use this to set up your games state before data is loaded from the drive or server.

LateInitialize

The function that is called during late initialization. Use this to set up your games state after data is loaded from the drive or server.

OnDestroy

Removes this from initialization, late initialization and save, if still included.

bottom of page