Class PlayerPrefsUtilities
Utilities for working with PlayerPrefs Contains e.g. support for more types
Inheritance
Namespace: i5.Toolkit.Core.Utilities
Assembly: cs.temp.dll.dll
Syntax
public static class PlayerPrefsUtilities
Methods
GetArrayLength(string)
Gets the array of a stored array
Declaration
public static int GetArrayLength(string key)
Parameters
Type | Name | Description |
---|---|---|
string | key | The key of the array |
Returns
Type | Description |
---|---|
int | Returns the intended length of the array. If no length was stored, it returns 0. |
GetColor(string, Color)
Gets a color under the given key from the PlayerPrefs
Declaration
public static Color GetColor(string key, Color defaultValue)
Parameters
Type | Name | Description |
---|---|---|
string | key | The key under which the color is stored |
Color | defaultValue | The default parameter which is returned in case no color is stored under this key |
Returns
Type | Description |
---|---|
Color | Returns the color if it exists, otherwise it returns the defaultValue |
GetColor(string)
Gets a color under the given key from the PlayerPrefs
Declaration
public static Color GetColor(string key)
Parameters
Type | Name | Description |
---|---|---|
string | key | The key under which the color is stored |
Returns
Type | Description |
---|---|
Color | Returns the color if it exists, otherwise it returns white |
GetFloatArray(string)
Gets a float array from the given key in the PlayerPrefs
Declaration
public static float[] GetFloatArray(string key)
Parameters
Type | Name | Description |
---|---|---|
string | key | The key of the array |
Returns
Type | Description |
---|---|
float[] | Returns the float array from the PlayerPrefs |
GetVector2(string, Vector2)
Gets a Vector2 from the PlayerPrefs
Declaration
public static Vector2 GetVector2(string key, Vector2 defaultValue)
Parameters
Type | Name | Description |
---|---|---|
string | key | The key under which to the vector is stored |
Vector2 | defaultValue | The default value which is taken if the vector does not exist in the PlayerPrefs |
Returns
Type | Description |
---|---|
Vector2 |
GetVector2(string)
Gets a Vector2 from the PlayerPrefs
Declaration
public static Vector2 GetVector2(string key)
Parameters
Type | Name | Description |
---|---|---|
string | key | The key under which to the vector is stored |
Returns
Type | Description |
---|---|
Vector2 |
GetVector3(string, Vector3)
Gets a Vector3 from the PlayerPrefs
Declaration
public static Vector3 GetVector3(string key, Vector3 defaultValue)
Parameters
Type | Name | Description |
---|---|---|
string | key | The key under which to the vector is stored |
Vector3 | defaultValue | The default value which is taken if the vector does not exist in the PlayerPrefs |
Returns
Type | Description |
---|---|
Vector3 |
GetVector3(string)
Gets a Vector3 from the PlayerPrefs
Declaration
public static Vector3 GetVector3(string key)
Parameters
Type | Name | Description |
---|---|---|
string | key | The key under which to the vector is stored |
Returns
Type | Description |
---|---|
Vector3 |
GetVector4(string, Vector4)
Gets a Vector4 from the PlayerPrefs
Declaration
public static Vector4 GetVector4(string key, Vector4 defaultValue)
Parameters
Type | Name | Description |
---|---|---|
string | key | The key under which to the vector is stored |
Vector4 | defaultValue | The default value which is taken if the vector does not exist in the PlayerPrefs |
Returns
Type | Description |
---|---|
Vector4 |
GetVector4(string)
Gets a Vector4 from the PlayerPrefs
Declaration
public static Vector4 GetVector4(string key)
Parameters
Type | Name | Description |
---|---|---|
string | key | The key under which to the vector is stored |
Returns
Type | Description |
---|---|
Vector4 |
HasColorKey(string)
Checks if a color is stored under the given key
Declaration
public static bool HasColorKey(string key)
Parameters
Type | Name | Description |
---|---|---|
string | key | The key under which the color is stored |
Returns
Type | Description |
---|---|
bool | Returns true if a color is stored under this key |
HasVectorKey(string)
Checks whether a vector was stored under the given key
Declaration
public static bool HasVectorKey(string key)
Parameters
Type | Name | Description |
---|---|---|
string | key | The key of the vector |
Returns
Type | Description |
---|---|
bool | Returns true if a vector with the key is stored in the PlayerPrefs, otherwise false |
SetColor(string, Color, bool)
Stores a color in the PlayerPrefs
Declaration
public static void SetColor(string key, Color color, bool saveAlpha = true)
Parameters
Type | Name | Description |
---|---|---|
string | key | The key under which the color should be stored |
Color | color | The color to store |
bool | saveAlpha | If set to false, the alpha value is not stored |
SetFloatArray(string, float[])
Stores a float array in the PlayerPrefs
Declaration
public static void SetFloatArray(string key, float[] array)
Parameters
Type | Name | Description |
---|---|---|
string | key | The key of the array |
float[] | array | The array to store in the PlayerPrefs |
SetVector2(string, Vector2)
Stores a Vector2 in the PlayerPrefs
Declaration
public static void SetVector2(string key, Vector2 vector)
Parameters
Type | Name | Description |
---|---|---|
string | key | The key under which to store the vector |
Vector2 | vector | The value of the vector |
SetVector3(string, Vector3)
Stores a Vector3 in the PlayerPrefs
Declaration
public static void SetVector3(string key, Vector3 vector)
Parameters
Type | Name | Description |
---|---|---|
string | key | The key under which to store the vector |
Vector3 | vector | The value of the vector |
SetVector4(string, Vector4)
Stores a Vector4 in the PlayerPrefs
Declaration
public static void SetVector4(string key, Vector4 vector)
Parameters
Type | Name | Description |
---|---|---|
string | key | The key under which to store the vector |
Vector4 | vector | The value of the vector |