| Parameter | Description |
|---|---|
| newPivot | The normalized position to set for the pivot. |
| adjustChildren | Whether to counter-adjust direct children with Transform components so they remain in place. The default value is false. |
Sets the pivot point of the RectTransform, adjusting the position to keep the rectangle in place.
adjustChildren only affects direct children without the RectTransform component, because RectTransform always takes its parent's pivot into account when calculating its position.
using UnityEngine;
public class Example : MonoBehaviour { RectTransform rectTransform;
void Start() { rectTransform = GetComponent<RectTransform>(); }
void Update() { rectTransform.SetPivotWithCounterAdjust(new Vector2(0f, 1f)); } }