Vector2 anchor = new Vector2([x of anchor (0=left, 1=right)],[y of anchor (0=bottom, 1=top]); panelRectTransform.anchorMin = anchor; panelRectTransform.anchorMax = anchor;