Documentation

Unity Engine


User Manual

Script Reference

Unity Engine


SetPivotAndAnchors(Vector2)

Sets the pivot, anchorMin, and anchorMax to the same value.
Read time 1 minuteLast updated 5 days ago

Definition

  • Type: Method
  • Namespace: UnityEngine
  • Assembly: UnityEngine.CoreModule
public void SetPivotAndAnchors(Vector2 position)

Parameters

position

The normalized position to assign to the pivot, anchorMin, and anchorMax.

Remarks

When RectTransform.pivot, RectTransform.anchorMin, and RectTransform.anchorMax are all equal, the RectTransform.anchoredPosition directly expresses the element's position as a normalized fraction of the parent rect. This is the most predictable coordinate model for programmatic layout. The RectTransform.sizeDelta and RectTransform.anchoredPosition are not modified.
Additional Resources: RectTransform.SetAnchors.