Class EditorPrefsCache
A cached version of UnityEditor.EditorPrefs, allowing for faster access.
Inheritance
Namespace: GDX.Editor
Syntax
public static class EditorPrefsCache
Remarks
It is important to use the equivalent set methods to update the cache.
Methods
| Improve this Doc View SourceGetBoolean(String, Boolean)
Get a cached value or fill it from UnityEditor.EditorPrefs.
Declaration
public static bool GetBoolean(string id, bool defaultValue = true)
Parameters
Type | Name | Description |
---|---|---|
System.String | id | Identifier for the System.Boolean value. |
System.Boolean | defaultValue | If no value is found, what should be used. |
Returns
Type | Description |
---|---|
System.Boolean | A boolean value. |
GetColor(String, Color)
Get a cached value or fill it from UnityEditor.EditorPrefs.
Declaration
public static Color GetColor(string id, Color defaultValue)
Parameters
Type | Name | Description |
---|---|---|
System.String | id | Identifier for the UnityEngine.Color value. |
UnityEngine.Color | defaultValue | If no value is found, what should be used. |
Returns
Type | Description |
---|---|
UnityEngine.Color | A color value. |
GetFloat(String, Single)
Get a cached value or fill it from UnityEditor.EditorPrefs.
Declaration
public static float GetFloat(string id, float defaultValue = 0F)
Parameters
Type | Name | Description |
---|---|---|
System.String | id | Identifier for the System.Single value. |
System.Single | defaultValue | If no value is found, what should be used. |
Returns
Type | Description |
---|---|
System.Single | A float value. |
GetInteger(String, Int32)
Get a cached value or fill it from UnityEditor.EditorPrefs.
Declaration
public static float GetInteger(string id, int defaultValue = -1)
Parameters
Type | Name | Description |
---|---|---|
System.String | id | Identifier for the System.Int32 value. |
System.Int32 | defaultValue | If no value is found, what should be used. |
Returns
Type | Description |
---|---|
System.Single | An integer value. |
GetString(String, String)
Get a cached value or fill it from UnityEditor.EditorPrefs.
Declaration
public static string GetString(string id, string defaultValue = null)
Parameters
Type | Name | Description |
---|---|---|
System.String | id | Identifier for the System.String value. |
System.String | defaultValue | If no value is found, what should be used. |
Returns
Type | Description |
---|---|
System.String | A string, or null. |
SetBoolean(String, Boolean)
Sets the cached value (and UnityEditor.EditorPrefs) for the id
.
Declaration
public static void SetBoolean(string id, bool setValue)
Parameters
Type | Name | Description |
---|---|---|
System.String | id | Identifier for the System.Boolean value. |
System.Boolean | setValue | The desired value to set. |
SetColor(String, Color)
Sets the cached value (and UnityEditor.EditorPrefs) for the id
.
Declaration
public static void SetColor(string id, Color setValue)
Parameters
Type | Name | Description |
---|---|---|
System.String | id | Identifier for the UnityEngine.Color value. |
UnityEngine.Color | setValue | The desired value to set. |
SetFloat(String, Single)
Sets the cached value (and UnityEditor.EditorPrefs) for the id
.
Declaration
public static void SetFloat(string id, float setValue)
Parameters
Type | Name | Description |
---|---|---|
System.String | id | Identifier for the System.Single value. |
System.Single | setValue | The desired value to set. |
SetInteger(String, Int32)
Sets the cached value (and UnityEditor.EditorPrefs) for the id
.
Declaration
public static void SetInteger(string id, int setValue)
Parameters
Type | Name | Description |
---|---|---|
System.String | id | Identifier for the System.Int32 value. |
System.Int32 | setValue | The desired value to set. |
SetString(String, String)
Sets the cached value (and UnityEditor.EditorPrefs) for the id
.
Declaration
public static void SetString(string id, string setValue)
Parameters
Type | Name | Description |
---|---|---|
System.String | id | Identifier for the System.String value. |
System.String | setValue | The desired value to set. |