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