docs.unity3d.com
Search Results for

    Show / Hide Table of Contents

    Interface IUserSetting

    Types implementing IUserSetting are eligible for use with UserSettingAttribute, which enables fields to automatically populate the UserSettingsProvider interface.

    Namespace: UnityEditor.SettingsManagement
    Assembly: Unity.Settings.Editor.dll
    Syntax
    public interface IUserSetting

    Properties

    key

    Declaration
    string key { get; }
    Property Value
    Type Description
    string

    The key for this value.

    scope

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

    At which scope this setting is saved.

    settings

    Declaration
    Settings settings { get; }
    Property Value
    Type Description
    Settings

    The Settings instance that this setting should be saved and loaded from.

    settingsRepositoryName

    The name of the ISettingsRepository that this setting should be associated with. If null, the first repository matching the scope will be used.

    Declaration
    string settingsRepositoryName { get; }
    Property Value
    Type Description
    string

    type

    Declaration
    Type type { get; }
    Property Value
    Type Description
    Type

    The type of the stored value.

    Methods

    ApplyModifiedProperties()

    When the inspected type is a reference value, it is possible to change properties without affecting the backing setting. ApplyModifiedProperties provides a method to force serialize these changes.

    Declaration
    void ApplyModifiedProperties()

    Delete(bool)

    Delete the saved setting. Does not clear the current value.

    Declaration
    void Delete(bool saveProjectSettingsImmediately = false)
    Parameters
    Type Name Description
    bool saveProjectSettingsImmediately

    True to immediately re-serialize project settings.

    GetDefaultValue()

    Get the default value for this setting.

    Declaration
    object GetDefaultValue()
    Returns
    Type Description
    object

    The default value for this setting.

    GetValue()

    Get the stored value. If you are implementing IUserSetting it is recommended that you cache this value.

    Declaration
    object GetValue()
    Returns
    Type Description
    object

    The stored value.

    Reset(bool)

    Set the current value back to the default.

    Declaration
    void Reset(bool saveProjectSettingsImmediately = false)
    Parameters
    Type Name Description
    bool saveProjectSettingsImmediately

    True to immediately re-serialize project settings.

    SetValue(object, bool)

    Set the value for this setting.

    Declaration
    void SetValue(object value, bool saveProjectSettingsImmediately = false)
    Parameters
    Type Name Description
    object value

    The new value.

    bool saveProjectSettingsImmediately

    True to immediately serialize the ISettingsRepository that is backing this value, or false to postpone. If not serializing immediately, be sure to call Save().

    In This Article
    Back to top
    Copyright © 2025 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)