void SetProperty(GameObject gameObject, Component component, string propertyName, string argument)
{
Type componentType = component.GetType();
PropertyInfo pInfo = componentType.GetProperty(propertyName);
if (pInfo != null)
{
bool paramSuccess = true;
object pArgument = null;
paramSuccess = ParseStringToObject(pInfo.PropertyType, argument, ref pArgument);
if (paramSuccess)
{
pInfo.SetValue(component, pArgument, null);
}
else
{
PrintToConsole( "Failed to set variable of type " + pInfo.PropertyType.ToString() );
}
}
}