Search Results for

    Show / Hide Table of Contents

    Class PlayerPrefsUtilities

    Utilities for working with PlayerPrefs Contains e.g. support for more types

    Inheritance
    Object
    PlayerPrefsUtilities
    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
    Int32

    Returns the intended length of the array. If no length was stored, it returns 0.

    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

    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

    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
    Single[]

    Returns the float array from the PlayerPrefs

    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

    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

    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

    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

    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

    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

    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
    Boolean

    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
    Boolean

    Returns true if a vector with the key is stored in the PlayerPrefs, otherwise false

    SetColor(String, Color, Boolean)

    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

    Boolean saveAlpha

    If set to false, the alpha value is not stored

    SetFloatArray(String, Single[])

    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

    Single[] 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

    In This Article
    Back to top i5 Toolkit Documentation