Interface IDataPersistence
Namespace: UnityEngine.GameFoundation.DataPersistence
Syntax
public interface IDataPersistence
Methods
Load<T>(String, Action<ISerializableData>, Action)
Asynchronously loads data from the persistence layer. Deserialized data, when loaded, are passed as second argument of the given onFinish Action. The generic param will be provided by the serializer underneath and need to implement ISerializableData
Declaration
void Load<T>(string identifier, Action<ISerializableData> onLoadCompleted = null, Action onLoadFailed = null)
where T : ISerializableData
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | identifier | Identifier of the persistence entry (filename, url, ...) |
| System.Action<ISerializableData> | onLoadCompleted | Called when the loading is completed with success |
| System.Action | onLoadFailed | Called when the loading failed |
Type Parameters
| Name | Description |
|---|---|
| T |
Save(String, ISerializableData, Action, Action)
Asynchronously saves data onto the persistence layer. When the async save operation is done, onFinish Action get called.
Declaration
void Save(string identifier, ISerializableData content, Action onSaveCompleted = null, Action onSaveFailed = null)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | identifier | Identifier of the persistence entry (filename, url, ...) |
| ISerializableData | content | Data to persist (need to be serializable) |
| System.Action | onSaveCompleted | Called when the saving is completed with success |
| System.Action | onSaveFailed | Called when the loading failed |