# SetPivotWithCounterAdjust(Vector2, bool)

> Sets the pivot point of the RectTransform, adjusting the position to keep the rectangle in place.

## Definition

* **Type:** Method
* **Namespace:** [UnityEngine](/engine/6000.6/script-reference/unityengine.md)
* **Assembly:** UnityEngine.CoreModule

```csharp
public void SetPivotWithCounterAdjust(Vector2 newPivot, bool adjustChildren = false)
```

### Parameters

**** (\[Vector2]\(/engine/6000.6/script-reference/unityengine/vector2)): The normalized position to set for the pivot.**** (\[bool]\(https\://learn.microsoft.com/dotnet/api/system.boolean)): Whether to counter-adjust direct children with Transform components so they remain in place. The default value is false.

### Remarks

adjustChildren only affects direct children without the `RectTransform` component, because `RectTransform` always takes its parent's pivot into account when calculating its position.

### Examples

```csharp
using UnityEngine;

public class Example : MonoBehaviour
{
    RectTransform rectTransform;

    void Start()
    {
        rectTransform = GetComponent<RectTransform>();
    }

    void Update()
    {
        rectTransform.SetPivotWithCounterAdjust(new Vector2(0f, 1f));
    }
}
```
