docs.unity3d.com
Search Results for

    Show / Hide Table of Contents

    Method Get

    Get<T>(string, SettingsScope, T)

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

    Declaration
    public T Get<T>(string key, SettingsScope scope = SettingsScope.Project, T fallback = default)
    Parameters
    Type Name Description
    string key

    The settings key.

    SettingsScope scope

    Which scope this settings should be retrieved from.

    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.

    Get<T>(string, string, SettingsScope, T)

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

    Declaration
    public T Get<T>(string key, string repositoryName, SettingsScope scope = SettingsScope.Project, T fallback = default)
    Parameters
    Type Name Description
    string key

    The settings key.

    string repositoryName

    The repository name to match.

    SettingsScope scope

    Which scope this settings should be retrieved from.

    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.

    Get<T, K>(string, T, string)

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

    Declaration
    public T Get<T, K>(string key, T fallback = default, string repositoryName = null) where K : ISettingsRepository
    Parameters
    Type Name Description
    string key

    The settings key.

    T fallback

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

    string repositoryName

    If provided, only repositories with a matching name will be searched for the key.

    Returns
    Type Description
    T
    Type Parameters
    Name Description
    T

    Type of value to search for.

    K

    Only repositories of type K will be searched for matching keys.

    In This Article
    Back to top
    Copyright © 2024 Unity Technologies — Trademarks and terms of use
    • Legal
    • Privacy Policy
    • Cookie Policy
    • Do Not Sell or Share My Personal Information
    • Your Privacy Choices (Cookie Settings)