set width of rect transform unity

C#
rectTransform.sizeDelta = new Vector2(50, 50);
Source

Also in C#: