void SetField ( GameObject gameObject, Component component, string fieldName, string argument )
{
Type componentType = component.GetType();
FieldInfo fInfo = componentType.GetField( fieldName );
if ( fInfo != null )
{
bool paramSuccess = true;
object pArgument = null;
paramSuccess = ParseStringToObject(fInfo.FieldType, argument, ref pArgument);
if (paramSuccess)
{
fInfo.SetValue(component, pArgument);
}
else
{
PrintToConsole( "Failed to set variable of type " + fInfo.FieldType.ToString() );
}
}
}