SetAnchors(Vector2)
Sets both anchorMin and anchorMax to the same value, collapsing the anchor to a point.
Read time 1 minuteLast updated 6 days ago
Definition
- Type: Method
- Namespace: UnityEngine
- Assembly: UnityEngine.CoreModule
public void SetAnchors(Vector2 position)
Parameters
The normalized position within the parent RectTransform to assign to both anchors.
Remarks
Equivalent to assigning the same value to RectTransform.anchorMin and RectTransform.anchorMax individually. Collapsing the anchors to a point is the standard setup for positioning an element at a fixed location regardless of parent size. The RectTransform.sizeDelta and RectTransform.anchoredPosition are not modified.
Additional Resources: RectTransform.SetPivotAndAnchors.