To modify a RectTransform's size at runtime, you can't modify its rect.with/height properties (rect being read-only),BUT, you can modify the RectTransform.sizeDelta value, to the same effect.