Interface ISettingsRepository | Package Manager UI website
docs.unity3d.com
    Show / Hide Table of Contents

    Interface ISettingsRepository

    A settings repository is responsible for implementing the saving and loading of values.

    Namespace: UnityEditor.SettingsManagement
    Syntax
    public interface ISettingsRepository

    Properties

    name

    A name to identify this repository.

    Declaration
    string name { get; }
    Property Value
    Type Description
    System.String

    path

    Declaration
    string path { get; }
    Property Value
    Type Description
    System.String

    File path to the serialized settings data.

    scope

    Declaration
    SettingsScope scope { get; }
    Property Value
    Type Description
    SettingsScope

    What SettingsScope this repository applies to.

    Methods

    ContainsKey<T>(String)

    Does the repository contain a setting with key and type.

    Declaration
    bool ContainsKey<T>(string key)
    Parameters
    Type Name Description
    System.String key

    The settings key.

    Returns
    Type Description
    System.Boolean

    True if a setting matching both key and type is found, false if no entry is found.

    Type Parameters
    Name Description
    T

    The type of value to search for.

    Get<T>(String, T)

    Get a value with key of type T, or return the fallback value if no matching key is found.

    Declaration
    T Get<T>(string key, T fallback = null)
    Parameters
    Type Name Description
    System.String key

    The settings key.

    T fallback

    If no key with a value of type T is found, this value is returned.

    Returns
    Type Description
    T
    Type Parameters
    Name Description
    T

    Type of value to search for.

    Remove<T>(String)

    Remove a key value pair from the settings repository.

    Declaration
    void Remove<T>(string key)
    Parameters
    Type Name Description
    System.String key
    Type Parameters
    Name Description
    T

    Save()

    Save all settings to their serialized state.

    Declaration
    void Save()

    Set<T>(String, T)

    Set a value for key of type T.

    Declaration
    void Set<T>(string key, T value)
    Parameters
    Type Name Description
    System.String key

    The settings key.

    T value

    The value to set. Must be serializable.

    Type Parameters
    Name Description
    T

    Type of 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