Class LocalPersistence | Package Manager UI website
docs.unity.cn
    Show / Hide Table of Contents

    Class LocalPersistence

    Inheritance
    System.Object
    BaseDataPersistence
    LocalPersistence
    Inherited Members
    BaseDataPersistence.k_SaveVersion
    BaseDataPersistence.serializer
    Namespace: UnityEngine.GameFoundation.DataPersistence
    Syntax
    public class LocalPersistence : BaseDataPersistence, IDataPersistence

    Constructors

    LocalPersistence(IDataSerializer)

    Declaration
    public LocalPersistence(IDataSerializer serializer)
    Parameters
    Type Name Description
    IDataSerializer serializer

    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
    public override 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
    Overrides
    BaseDataPersistence.Load<T>(String, Action<ISerializableData>, Action)

    Save(String, ISerializableData, Action, Action)

    Asynchronously saves data onto the persistence layer. When the async save operation is done, onFinish Action get called.

    Declaration
    public override 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

    Overrides
    BaseDataPersistence.Save(String, ISerializableData, Action, Action)
    Back to top Copyright © 2019 Unity Technologies
    Generated by DocFX