Version: Unity 6.6 Alpha (6000.6)
LanguageEnglish
  • C#

RectTransform.SetPivotAndAnchors

Suggest a change

Success!

Thank you for helping us improve the quality of Unity Documentation. Although we cannot accept all submissions, we do read each suggested change from our users and will make updates where applicable.

Close

Submission failed

For some reason your suggested change could not be submitted. Please <a>try again</a> in a few minutes. And thank you for taking the time to help us improve the quality of Unity Documentation.

Close

Cancel

Declaration

public void SetPivotAndAnchors(Vector2 position);

Parameters

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

Description

Sets the pivot, anchorMin, and anchorMax to the same value.

When pivot, anchorMin, and anchorMax are all equal, the 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 sizeDelta and anchoredPosition are not modified.

Additional resources: SetAnchors.