Class UserSettingsRepository
Represents a settings repository for user preferences.
Namespace: UnityEditor.SettingsManagement
Syntax
public class UserSettingsRepository : object, 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". |
Implements
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. |
Implements
Remarks
This property returns an empty string.
See Also
scope
Gets the
Declaration
public SettingsScope scope { get; }
Property Value
| Type | Description |
|---|---|
| SettingsScope | Indicates that this is a |
Implements
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 |
|---|---|
| Boolean | True if a settings entry matches both |
Type Parameters
| Name | Description |
|---|---|
| T | The type of value that this key points to. |
Implements
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 = null)
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. |
Implements
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. |
Implements
Save()
Saves all settings to their serialized state.
Declaration
public void Save()
Implements
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. |