Would be nice to have a TryGet<T> for all variable types.
bool Variables.Object(GameObject object).TryGet<T>(string variable, out T object)
This should return false if the variable doesn't exist or is of invalid type, true if it exists and is of valid type. out T object should of cause be the variable value, or if the variable doesn't exist or is of invalid type it should return default(T);
Here is my own implementation - would be nice if it was part of Bolt though.
public static class BoltExtension
public static bool TryGet<T>(this VariableDeclarations varDeclerations, string variable, out T value)
object tmp = varDeclerations.Get(variable);
if (tmp is T)
value = (T)tmp;
value = default(T);
Customer support service by UserEcho