Public classes

HiddenVars


Introduction page

HiddenVars
Derived from IDisposable


Main class for HiddenVars. Also only public class.

New instance can be create with normal constructor, new HiddenVars() or new HiddenVars(string). After that, values can be written or read, using Set and Get methods.

Note that when reading lists from HiddenVars, returned plain value is copy of hidden value. Meaning that if any changes are made to plain value list, it does not change value stored in HiddenVars, until Set method is used again to overwrite old value in HiddenVars instance. For example:

HiddenVars hiddenVars = new HiddenVars();
hiddenVars.SetIntList("someKey",new int[]{0,1,2,3,4});
IList<int> intListFromHV = hiddenVars.GetIntList("someKey");
intListFromHV[0] = 5;
Debug.Log(hiddenVars.GetIntList("someKey")[0]); // Prints out "0", previous line didn't change value stored to HiddenVars instance
hiddenVars.SetIntList("someKey",intListFromHV); // Saves the modified list to HiddenVars instance
Debug.Log(hiddenVars.GetIntList("someKey")[0]); // Prints out "5"


Constructors

public HiddenVars ()Initializes a new instance of the HiddenVars class.
public HiddenVars (string nameForDebug)Initializes a new instance of the HiddenVars class with specific debug name.

Indexer

public int this [string key]Gets or sets integer value with the specified key.

Properties

public int CountReturns count of key/value pairs in this instance.

Methods

public void Clear ()Remove all the keys and values.
public bool ContainsKey (string key)Checks whether any type of value identified by key exists.
public void Dispose ()Clear and destroy this instance.
public bool GetBool (string key)Get boolean value identified by key.
public bool GetBool (string key, bool defaultValue)Get boolean value identified by key or default value if key is not found.
public List GetBoolList (string key)Get boolean list identified by key.
public List GetBoolList (string key, List defaultList)Get bool list identified by key or default list if key is not found.
public byte[] GetByteArray (string key)Get byte array identified by key.
public byte[] GetByteArray (string key, byte[] defaultArray)Get byte array identified by key or default value if key is not found.
public double GetDouble (string key)Get double value identified by key.
public double GetDouble (string key, double defaultValue)Get double value identified by key or default value if key is not found.
public List GetDoubleList (string key)Get double list identified by key.
public List GetDoubleList (string key, List defaultList)Get double list identified by key or default list if key is not found.
public float GetFloat (string key)Get float value identified by key.
public float GetFloat (string key, float defaultValue)Get float value identified by key or default value if key is not found.
public List GetFloatList (string key)Get float list identified by key.
public List GetFloatList (string key, List defaultList)Get float list identified by key or default list if key is not found.
public int GetInt (string key)Get integer value identified by key.
public int GetInt (string key, int defaultValue)Get integer value identified by key or default value if key is not found.
public List GetIntList (string key)Get integer list identified by key.
public List GetIntList (string key, List defaultList)Get integer list identified by key or default list if key is not found.
public string[] GetKeys ()Get list of all keys in this instance.
public long GetLong (string key)Get long value identified by key.
public long GetLong (string key, long defaultValue)Get long value identified by key or default value if key is not found.
public List GetLongList (string key)Get long list identified by key.
public List GetLongList (string key, List defaultList)Get long list identified by key or default list if key is not found.
public string GetString (string key)Get string identified by key.
public string GetString (string key, string defaultValue)Get string identified by key or default value if key is not found.
public bool Remove (string key)Remove any type of value identified by key.
public void SetBool (string key, bool value)Set boolean value identified by key.
public void SetBoolList (string key, IList values)Set boolean list identified by key.
public void SetByteArray (string key, byte[] value)Set byte array identified by key.
public void SetDouble (string key, double value)Set double value identified by key.
public void SetDoubleList (string key, IList values)Set double list identified by key.
public void SetFloat (string key, float value)Set float value identified by key.
public void SetFloatList (string key, IList values)Set float list identified by key.
public void SetInt (string key, int value)Set integer value identified by key.
public void SetIntList (string key, IList values)Set integer list identified by key.
public void SetLong (string key, long value)Set long value identified by key.
public void SetLongList (string key, IList values)Set long list identified by key.
public void SetString (string key, string value)Set string value identified by key.

Constructors

public HiddenVars ()

Initializes a new instance of the HiddenVars class.


public HiddenVars (string nameForDebug)

Initializes a new instance of the HiddenVars class with specific debug name.

Debug name have no effect to actual functionality of this class and have meaning only when running application in Unity Editor.

ParametersnameForDebugDebug name for this instance, visible in "HiddenVars EditorOnly RunTimeDebug" game object in the Unity Editor when application is running. There can be multiple instances of HiddenVars with same debug name. If parameter is null, default name is generated.


Indexer

public int this [string key]

Gets or sets integer value with the specified key.

Functionality is identical compared to using GetInt and SetInt methods.

ParameterskeyKey of the value to set or get

ValueInteger value


Properties

public int Count

Returns count of key/value pairs in this instance.


Methods

public void Clear ()

Remove all the keys and values.


public bool ContainsKey (string key)

Checks whether any type of value identified by key exists.

ParameterskeyKey to locate

ReturnsTrue if key and value exists


public void Dispose ()

Clear and destroy this instance. This method will also remove instance from RunTimeDebug object if running application in Unity Editor. After calling this method, instance is not usable any more and trying to add or read any values will cause exception.


public bool GetBool (string key)

Get boolean value identified by key.

ParameterskeyKey of the boolean value to get

ReturnsBoolean value

ExceptionsKeyNotFoundExceptionValue with specified key doesn't exist


public bool GetBool (string key, bool defaultValue)

Get boolean value identified by key or default value if key is not found.

ParameterskeyKey of the boolean value to get
 defaultValueDefault boolean value to return if key does not exist

ReturnsBoolean value or default boolean value


public List GetBoolList (string key)

Get boolean list identified by key.

ParameterskeyKey of the boolean list to get

ReturnsBoolean list

ExceptionsKeyNotFoundExceptionValue with specified key doesn't exist


public List GetBoolList (string key, List defaultList)

Get bool list identified by key or default list if key is not found.

ParameterskeyKey of the bool list to get
 defaultListDefault bool list to return if key does not exist

ReturnsBool list


public byte[] GetByteArray (string key)

Get byte array identified by key.

ParameterskeyKey of the byte array to get

ReturnsByte array

ExceptionsKeyNotFoundExceptionValue with specified key doesn't exist


public byte[] GetByteArray (string key, byte[] defaultArray)

Get byte array identified by key or default value if key is not found.

ParameterskeyKey of the byte array to get
 defaultArrayDefault byte array to return if key does not exist (may be null)

ReturnsByte array or default byte array


public double GetDouble (string key)

Get double value identified by key.

ParameterskeyKey of the double value to get

ReturnsDouble value

ExceptionsKeyNotFoundExceptionValue with specified key doesn't exist


public double GetDouble (string key, double defaultValue)

Get double value identified by key or default value if key is not found.

ParameterskeyKey of the double value to get
 defaultValueDefault double value to return if key does not exist

ReturnsDouble value or default value


public List GetDoubleList (string key)

Get double list identified by key.

ParameterskeyKey of the double list to get

ReturnsDouble list

ExceptionsKeyNotFoundExceptionValue with specified key doesn't exist


public List GetDoubleList (string key, List defaultList)

Get double list identified by key or default list if key is not found.

ParameterskeyKey of the double list to get
 defaultListDefault double list to return if key does not exist

ReturnsDouble list


public float GetFloat (string key)

Get float value identified by key.

ParameterskeyKey of the float value to get

ReturnsFloat value

ExceptionsKeyNotFoundExceptionValue with specified key doesn't exist


public float GetFloat (string key, float defaultValue)

Get float value identified by key or default value if key is not found.

ParameterskeyKey of the float value to get
 defaultValueDefault float value to return if key does not exist

ReturnsFloat value or default float value


public List GetFloatList (string key)

Get float list identified by key.

ParameterskeyKey of the float list to get

ReturnsFloat list

ExceptionsKeyNotFoundExceptionValue with specified key doesn't exist


public List GetFloatList (string key, List defaultList)

Get float list identified by key or default list if key is not found.

ParameterskeyKey of the float list to get
 defaultListDefault float list to return if key does not exist

ReturnsFloat list


public int GetInt (string key)

Get integer value identified by key.

ParameterskeyKey of the integer value to get

ReturnsInteger value

ExceptionsKeyNotFoundExceptionValue with specified key doesn't exist


public int GetInt (string key, int defaultValue)

Get integer value identified by key or default value if key is not found.

ParameterskeyKey of the integer value to get
 defaultValueDefault integer value to return if key does not exist

ReturnsInteger value or default integer value


public List GetIntList (string key)

Get integer list identified by key.

ParameterskeyKey of the integer list to get

ReturnsInteger list

ExceptionsKeyNotFoundExceptionValue with specified key doesn't exist


public List GetIntList (string key, List defaultList)

Get integer list identified by key or default list if key is not found.

ParameterskeyKey of the integer list to get
 defaultListDefault integer list to return if key does not exist

ReturnsInteger list


public string[] GetKeys ()

Get list of all keys in this instance. Returned array is copy of the keys at the moment when this method was called. Changing values or setting them null in returned array doesn't affect this HiddenVars instance in any way.

ReturnsArray of string keys.


public long GetLong (string key)

Get long value identified by key.

ParameterskeyKey of the long value to get

ReturnsLong value

ExceptionsKeyNotFoundExceptionValue with specified key doesn't exist


public long GetLong (string key, long defaultValue)

Get long value identified by key or default value if key is not found.

ParameterskeyKey of the long value to get
 defaultValueDefault long value to return if key does not exist

ReturnsLong value or default value


public List GetLongList (string key)

Get long list identified by key.

ParameterskeyKey of the long list to get

ReturnsLong list

ExceptionsKeyNotFoundExceptionValue with specified key doesn't exist


public List GetLongList (string key, List defaultList)

Get long list identified by key or default list if key is not found.

ParameterskeyKey of the long list to get
 defaultListDefault long list to return if key does not exist

ReturnsLong list


public string GetString (string key)

Get string identified by key.

ParameterskeyKey of the string to get

ReturnsString

ExceptionsKeyNotFoundExceptionValue with specified key doesn't exist


public string GetString (string key, string defaultValue)

Get string identified by key or default value if key is not found.

ParameterskeyKey of the string to get
 defaultValueDefault string value to return if key does not exist (may be null)

ReturnsString or default string


public bool Remove (string key)

Remove any type of value identified by key.

ParameterskeyKey of the value to be removed

ReturnsTrue if key was found and value removed, otherwise false


public void SetBool (string key, bool value)

Set boolean value identified by key. If there's any previous value with same key, it will be replaced.

ParameterskeyKey of the boolean value to set
 valueBoolean value to be hidden


public void SetBoolList (string key, IList values)

Set boolean list identified by key. If there's any previous value with same key, it will be replaced.

ParameterskeyKey of the boolean list to set
 valuesBoolean list to be hidden


public void SetByteArray (string key, byte[] value)

Set byte array identified by key. If there's any previous value with same key, it will be replaced.

ParameterskeyKey of the byte array to set
 valueByte array to be hidden (can not be null but length may be zero)


public void SetDouble (string key, double value)

Set double value identified by key. If there's any previous value with same key, it will be replaced.

ParameterskeyKey of the double value to set
 valueDouble value to be hidden (may be NaN, positive infinity or negative infinity)


public void SetDoubleList (string key, IList values)

Set double list identified by key. If there's any previous value with same key, it will be replaced.

ParameterskeyKey of the double list to set
 valuesDouble list to be hidden


public void SetFloat (string key, float value)

Set float value identified by key. If there's any previous value with same key, it will be replaced.

ParameterskeyKey of the float value to set
 valueFloat value to be hidden (may be NaN, positive infinity or negative infinity)


public void SetFloatList (string key, IList values)

Set float list identified by key. If there's any previous value with same key, it will be replaced.

ParameterskeyKey of the float list to set
 valuesFloat list to be hidden


public void SetInt (string key, int value)

Set integer value identified by key. If there's any previous value with same key, it will be replaced.

ParameterskeyKey of the integer value to set
 valueInteger value to be hidden


public void SetIntList (string key, IList values)

Set integer list identified by key. If there's any previous value with same key, it will be replaced.

ParameterskeyKey of the integer list to set
 valuesInteger list to be hidden


public void SetLong (string key, long value)

Set long value identified by key. If there's any previous value with same key, it will be replaced.

ParameterskeyKey of the long value to set
 valueLong value to be hidden


public void SetLongList (string key, IList values)

Set long list identified by key. If there's any previous value with same key, it will be replaced.

ParameterskeyKey of the long list to set
 valuesLong list to be hidden


public void SetString (string key, string value)

Set string value identified by key. If there's any previous value with same key, it will be replaced.

ParameterskeyKey of the string value to set
 valueString to be hidden (can not be null but length may be zero)