void GetField ( GameObject gameObject, Component component, string fieldName ) { Type componentType = component.GetType(); FieldInfo fInfo = componentType.GetField( fieldName ); if ( fInfo != null ) { PrintToConsole( fInfo.GetValue( component ).ToString() ); } }