public static void SetVolumeOfCargo(Vehicles io_Vehicle) { float volumeOfCargo; System.Type vehicleType = io_Vehicle.GetType(); PropertyInfo propertyInfo = vehicleType.GetProperty("VolumeOfCargo"); if (propertyInfo != null) { volumeOfCargo = GarageUI.GetVolumeOfCargo(); propertyInfo.SetValue(io_Vehicle, volumeOfCargo, null); } }