Interface IUserSetting | Package Manager UI website
docs.unity3d.com
    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
    Syntax
    public interface IUserSetting

    Properties

    key

    Declaration
    string key { get; }
    Property Value
    Type Description
    System.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
    System.String

    type

    Declaration
    Type type { get; }
    Property Value
    Type Description
    System.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(Boolean)

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

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

    True to immediately re-serialize project settings.

    GetDefaultValue()

    Get the default value for this setting.

    Declaration
    object GetDefaultValue()
    Returns
    Type Description
    System.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
    System.Object

    The stored value.

    Reset(Boolean)

    Set the current value back to the default.

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

    True to immediately re-serialize project settings.

    SetValue(Object, Boolean)

    Set the value for this setting.

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

    The new value.

    System.Boolean 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().

    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