Class UserSettingsRepository
Represents a settings repository for user preferences.
Implements
Inherited Members
Namespace: UnityEditor.SettingsManagement
Assembly: Unity.Settings.Editor.dll
Syntax
public class UserSettingsRepository : ISettingsRepository
Properties
name
Gets the identifying name for this repository.
Declaration
public string name { get; }
Property Value
| Type | Description |
|---|---|
| string | User settings are named "EditorPrefs". |
See Also
path
Gets the full path to the file containing the serialized settings data.
Declaration
public string path { get; }
Property Value
| Type | Description |
|---|---|
| string | The location stored for this repository. |
Remarks
This property returns an empty string.
See Also
scope
Gets the scope this repository applies to.
Declaration
public SettingsScope scope { get; }
Property Value
| Type | Description |
|---|---|
| SettingsScope | Indicates that this is a User preference. |
See Also
Methods
ContainsKey<T>(string)
Determines whether this repository contains a settings entry that matches the specified key and is of type T.
Declaration
public bool ContainsKey<T>(string key)
Parameters
| Type | Name | Description |
|---|---|---|
| string | key | The key used to identify the settings entry. |
Returns
| Type | Description |
|---|---|
| bool | True if a settings entry matches both |
Type Parameters
| Name | Description |
|---|---|
| T | The type of value that this key points to. |
See Also
Get<T>(string, T)
Returns a value for a settings entry with a matching key and type T.
Declaration
public T Get<T>(string key, T fallback = default)
Parameters
| Type | Name | Description |
|---|---|---|
| string | key | The key used to identify the settings entry. |
| T | fallback | Specify the value of type |
Returns
| Type | Description |
|---|---|
| T | The value matching both |
Type Parameters
| Name | Description |
|---|---|
| T | The type of value that this key points to. |
See Also
Remove<T>(string)
Removes a key-value pair from this settings repository. This method identifies the settings entry to remove
by matching the specified key for a value of type T.
Declaration
public void Remove<T>(string key)
Parameters
| Type | Name | Description |
|---|---|---|
| string | key | The key used to identify the settings entry. |
Type Parameters
| Name | Description |
|---|---|
| T | The type of value that this key points to. |
See Also
Save()
Saves all settings to their serialized state.
Declaration
public void Save()
See Also
Set<T>(string, T)
Sets a value for a settings entry with a matching key and type T.
Declaration
public void Set<T>(string key, T value)
Parameters
| Type | Name | Description |
|---|---|---|
| string | key | The key used to identify the settings entry. |
| T | value | The value to set. This must be serializable. |
Type Parameters
| Name | Description |
|---|---|
| T | The type of value that this key points to. |