Class KeyDataStore | Addressables | 1.13.1
docs.unity3d.com
    Show / Hide Table of Contents

    Class KeyDataStore

    Contains serialized data in a generic serializable container.

    Inheritance
    Object
    KeyDataStore
    Namespace: UnityEditor.AddressableAssets.Settings
    Syntax
    [Serializable]
    public class KeyDataStore : ISerializationCallbackReceiver

    Properties

    Keys

    The collection of keys stored.

    Declaration
    public IEnumerable<string> Keys { get; }
    Property Value
    Type Description
    IEnumerable<String>

    OnSetData

    Delegate that is invoked when data is modified.

    Declaration
    public Action<string, object, bool> OnSetData { get; set; }
    Property Value
    Type Description
    Action<String, Object, Boolean>

    Methods

    GetData<T>(String, T, Boolean)

    Get data via a specified key.

    Declaration
    public T GetData<T>(string key, T defaultValue, bool addDefault = false)
    Parameters
    Type Name Description
    String key

    The key.

    T defaultValue

    The default value to return if the data is not found.

    Boolean addDefault

    Optional parameter to control whether to add the default value if the data is not found.

    Returns
    Type Description
    T
    Type Parameters
    Name Description
    T

    The data type.

    OnAfterDeserialize()

    Implementation of ISerializationCallbackReceiver interface, used to convert data from its serializable form.

    Declaration
    public void OnAfterDeserialize()

    OnBeforeSerialize()

    Implementation of ISerializationCallbackReceiver interface, used to convert data to a serializable form.

    Declaration
    public void OnBeforeSerialize()

    SetData(String, Object)

    Set the value of a specified key.

    Declaration
    public void SetData(string key, object data)
    Parameters
    Type Name Description
    String key

    The key.

    Object data

    The data to store. Supported types are strings, POD types, objects that have a static method named 'Parse' that convert a string to an object, and object that are serializable via JSONUtilty.

    SetDataFromString(String, String)

    Set data for a specified key from a string.

    Declaration
    public void SetDataFromString(string key, string data)
    Parameters
    Type Name Description
    String key

    The data key.

    String data

    The data string value.

    Back to top
    Copyright © 2023 Unity Technologies — Terms of use
    • Legal
    • Privacy Policy
    • Cookies
    • Do Not Sell or Share My Personal Information
    • Your Privacy Choices (Cookie Settings)
    "Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
    Generated by DocFX on 18 October 2023