IPersistentStateManager Interface

public interface IPersistentStateManager

Represents a persistent state manager contract. You can create a class that implements this to control how data related to the Streamable Assets Manager is saved and loaded. This is used with the Component Manager's Save and Load methods.

Properties

Name Type Description
DisableAutoInvocationOfBeforeAndAfterLoadMethods bool

By default, when the Component Manager's Load method is called, it will automatically call OnBeforeDataLoaded before calling the Load... methods, and then it will automatically call OnAfterDataLoaded after all data has been loaded. In some instances, this may be undesirable, for instance if you want to load non Streamable Assets Manager data before or after the Component Manager's Load method is called.

In these instances, you can disable the auto calling of those two methods (by the Component Manager) by returning true with this properties implementation, however note that you will need to call the OnBeforeDataLoaded and OnAfterDataLoaded methods manually, before and after beginning/completing the load operation.

DisableAutoInvocationOfBeforeAndAfterSaveMethods bool

By default, when the Component Manager's Save or ConvetOldData methods are called, those methods will automatically call the OnBeforeDataSaved and OnAfterDataSaved methods before/after saving the data is saved. In some instances, this may be undesirable, for instance if you want to save non Streamable Assets Manager data before or after the Component Manager's Save method is called.

In these instances, you can disable the auto calling of those two methods (by the Component Manager) by returning true with this properties implementation, however note that you will need to call the OnBeforeDataSaved and OnAfterDataSaved methods yourself, before and after beginning/completing the save operations.

Methods

LoadBool()

bool LoadBool()

Loads a boolean value.

Returns

bool
The loaded boolean.


LoadDouble()

double LoadDouble()

Loads a double value.

Returns

double
The loaded double.


LoadFloat()

float LoadFloat()

Loads a float value.

Returns

float
The loaded float.


LoadInt()

int LoadInt()

Loads an integer value.

Returns

int
The loaded integer.


LoadString()

string LoadString()

Loads a string value.

Returns

string
The loaded string.


OnAfterDataLoaded()

void OnAfterDataLoaded()

If DisableAutoInvocationOfBeforeAndAfterLoadMethods is implemented to return false, this method will be called automatically by the Component Manager after it completes the loading process (when its Load method is called). This can be used to cleanup/finalize/close streams and other data, such as a file sream or binary writer.

If DisableAutoInvocationOfBeforeAndAfterLoadMethods is implemented to return true, you will need to manually call this method after completing the load operation. Usually, you would only do this if you have non Streamable Assets Manager data you wish to load using the IPersistentStateManager.


OnAfterDataSaved()

void OnAfterDataSaved()

If DisableAutoInvocationOfBeforeAndAfterSaveMethods is implemented to return false, this method will be called automatically by the Component Manager after it finishes the saving process (when its Save and ConvertOldSaveData methods are called). This can be used to cleanup/finalize/close streams and other data, such as a file sream or binary writer.

If DisableAutoInvocationOfBeforeAndAfterSaveMethods is implemented to return true, you will need to manually call this method after completing the save operation. Usually, you would only do this if you have non Streamable Assets Manager data you wish to save using the IPersistentStateManager.


OnBeforeDataLoaded()

void OnBeforeDataLoaded()

If DisableAutoInvocationOfBeforeAndAfterLoadMethods is implemented to return false, this method will be called automatically by the Component Manager before it starts the loading process (when its Load method is called). This can be used to setup anything needed to actually perform the load operations, such as a file sream or binary writer.

If DisableAutoInvocationOfBeforeAndAfterLoadMethods is implemented to return true, you will need to manually call this method before beginning the load operation. Usually, you would only do this if you have non Streamable Assets Manager data you wish to load using the IPersistentStateManager.


OnBeforeDataSaved()

void OnBeforeDataSaved()

If DisableAutoInvocationOfBeforeAndAfterSaveMethods is implemented to return false, this method will be called automatically by the Component Manager before it starts the saving process (when its Save or ConvertOldSaveData methods are called). This can be used to setup anything needed to actually perform the save operations, such as a file streams or binary writers.

If DisableAutoInvocationOfBeforeAndAfterSaveMethods is implemented to return true, you will need to manually call this method before beginning the save operation. Usually, you would only do this if you have non Streamable Assets Manager data you wish to save using the IPersistentStateManager.


SaveBool(bool)

void SaveBool(bool value)

Saves an boolean value.

Parameters

Name Type Description
value bool

The bool to save.


SaveDouble(double)

void SaveDouble(double value)

Saves a double value.

Parameters

Name Type Description
value double

The double to save.


SaveFloat(float)

void SaveFloat(float value)

Saves a float/single value.

Parameters

Name Type Description
value float

The float to save.


SaveInt(int)

void SaveInt(int value)

Saves an integer value.

Parameters

Name Type Description
value int

The integer to save.


SaveString(string)

void SaveString(string value)

Saves an string value.

Parameters

Name Type Description
value string

The string to save.