MultikeyPrefHelper provides convenience functions for checking, reading, storing and deleting Vector3, Vector2, Color, and Enums in Unity's preferences storage.
The PrefInterfaceType type parameter defines weather operations are performed on Unity PlayerPrefs or EditorPrefs. Based on the type of value being written, multiple editor pref keys may be used (transparently) to store the whole value. Each key will use the same key name, but have an additional character appended to specify what component of the value it represents. For example, a Vector3 stored with the key "MyVec", will ACTUALLY (though transparently) be stored as 3 key/value pairs, "MyVecX","MyVecY","MyVecZ" It is the programmers responsibility to make sure the type of each key is used consistently.
Static Public Member Functions | |
static void | DeleteBoolKey (this IStorePreferences interfaceReference, string key) |
Deletes the bool value associated with this key, in prefBase, to the provided bool value. Behind the scenes, the values are stored as an integer 0- false, 1-true | |
static void | DeleteColorKey (this IStorePreferences interfaceReference, string key) |
Deletes the Color (RGBA) value associated with this key, and the key itself, from prefBase. Behind the scenes, the key-float pairs deleted are, key+"R", key+"G", key+"B" and key+"A". | |
static void | DeleteVector2Key (this IStorePreferences interfaceReference, string key) |
Deletes the Vector2 value associated with this key, and the key itself, from prefBase. Behind the scenes, the key-float pairs deleted are, key+"X", and key+"Y". | |
static void | DeleteVector3Key (this IStorePreferences interfaceReference, string key) |
Deletes the Vector3 value associated with this key, and the key itself, from prefBase. Behind the scenes, the key-float pairs deleted are, key+"X", key+"Y" and key+"Z". | |
static bool | GetBool (this IStorePreferences interfaceReference, string key) |
Gets the bool value associated with this key, from prefBase. Behind the scenes, the values are stored as an integer 0- false, 1-true | |
static Color | GetColor (this IStorePreferences interfaceReference, string key) |
Gets the Color (RGBA) value associated with this key, from prefBase. Behind the scenes, the values are stored as three key-float pairs, key+"R",key+"G", key+"B" and key+"A" in prefBase | |
static Vector2 | GetVector2 (this IStorePreferences interfaceReference, string key) |
Gets the Vector2 value associated with this key, from prefBase. Behind the scenes, the values are stored as two key-float pairs, key+"X", and key+"Y" in prefBase | |
static Vector3 | GetVector3 (this IStorePreferences interfaceReference, string key) |
Gets the Vector3 value associated with this key, from prefBase. Behind the scenes, the values are stored as three key-float pairs, key+"X", key+"Y" and key+"Z" in prefBase | |
static bool | HasBoolKey (this IStorePreferences interfaceReference, string key) |
Check for the existence of key in prefBase | |
static bool | HasColorKey (this IStorePreferences interfaceReference, string key) |
Check for the existence of key +"R" in prefBase | |
static bool | HasVector2Key (this IStorePreferences interfaceReference, string key) |
Check for the existence of key +"X" in prefBase | |
static bool | HasVector3Key (this IStorePreferences interfaceReference, string key) |
Check for the existence of key +"X" in prefBase | |
static void | SetBool (this IStorePreferences interfaceReference, string key, bool value) |
Sets the bool value associated with this key, in prefBase, to the provided bool value. Behind the scenes, the values are stored as an integer 0- false, 1-true | |
static void | SetColor (this IStorePreferences interfaceReference, string key, Color color) |
Sets the Color value associated with this key, in prefBase, to the provided Vector2. Behind the scenes, the values are stored as three key-float pairs, key+"R",key+"G", key+"B" and key+"A" in prefBase | |
static void | SetVector2 (this IStorePreferences interfaceReference, string key, Vector2 vector) |
Sets the Vector2 value associated with this key, in prefBase, to the provided Vector3. Behind the scenes, the values are stored as two key-float pairs, key+"X", and key+"Y" in prefBase | |
static void | SetVector3 (this IStorePreferences interfaceReference, string key, Vector3 vector) |
Sets the Vector3 value associated with this key, in prefBase, to the provided Vector3. Behind the scenes, the values are stored as three key-float pairs, key+"X", key+"Y" and key+"Z" in prefBase | |