Class BaseDataPersistence
Base persistence class derived from IDataPersistence
Namespace: UnityEngine.GameFoundation.DefaultLayers.Persistence
Syntax
public abstract class BaseDataPersistence : IDataPersistence
Constructors
BaseDataPersistence(IDataSerializer)
Basic constructor that takes in a data serializer which this will use.
Declaration
public BaseDataPersistence(IDataSerializer serializer)
Parameters
Type | Name | Description |
---|---|---|
IDataSerializer | serializer | The data serializer to use. |
Properties
serializer
The serialization layer used by the processes of this persistence.
Declaration
protected IDataSerializer serializer { get; }
Property Value
Type | Description |
---|---|
IDataSerializer |
Methods
Load(Action<GameFoundationData>, Action<Exception>)
Asynchronously loads GameFoundation's data from the persistence layer.
Declaration
public abstract void Load(Action<GameFoundationData> onLoadCompleted = null, Action<Exception> onLoadFailed = null)
Parameters
Type | Name | Description |
---|---|---|
Action<GameFoundationData> | onLoadCompleted | Called with the loaded data when they have been successfully loaded. |
Action<Exception> | onLoadFailed | Called with a detailed exception when the loading failed. |
Implements
Save(GameFoundationData, Action, Action<Exception>)
Asynchronously saves GameFoundation's data onto the persistence layer.
Declaration
public abstract void Save(GameFoundationData content, Action onSaveCompleted = null, Action<Exception> onSaveFailed = null)
Parameters
Type | Name | Description |
---|---|---|
GameFoundationData | content | GameFoundation's data to persist. |
Action | onSaveCompleted | Called when data have been successfully saved. |
Action<Exception> | onSaveFailed | Called with a detailed exception when the save failed. |