Loading

How to load data from SaveStates.

Single

The main method to load data is the generic GetData method. Replace T with the type of the data you're trying to retrieve.

// Where T is the data type
saveState.GetData<T>("DataID").OnComplete(result =>
{
    Debug.Log(result);
});

This method returns a Save Operation (result type: T).

Multiple (Single Type)

You can also retrieve a list of data of the same type:

// Where T is the data type
saveState.GetData<T>("DataID1", "DataID2", "DataID3").OnComplete(result =>
{
    Debug.Log(result["DataID1"]);
    Debug.Log(result["DataID2"]);
    Debug.Log(result["DataID3"]);
});

This method returns a Save Operation (result type: Dictionary<string, T>).

Multiple (Multi-Type)

It's also possible to retrieve a list of data of unique types. This can be done by providing a value tuple where the first item is the data ID and the second is the data type.

This method returns a Save Operation (result type: Dictionary<string, dynamic>).

Special Methods

ESave features special methods to retrieve data for some otherwise unsavable Unity types.

Vector2

Vector3

Vector4

Vector2Int

Vector3Int

Quaternion

Color

Transform

RectTransform

Last updated