---
tags:
    - "UI, Layout"
---

# Rect Transform Set Pivot With Counter Adjust

[UI](../../index.md) / [Layout](../index.md) / [Rect Transform](index.md) / **Rect Transform Set Pivot With Counter Adjust**

## Description

Executes the Set Pivot With Counter Adjust method on the Rect Transform component

## Parameters

| Name | Description |
| :--- | :---------- |
| New Pivot |  |
| Adjust Children |  |

## Code

```cs
// <auto-generated>
// This script was automatically generated using the Visual Script Transpiler.
// Do not modify. Changes to this file will be lost when updating the package.
// </auto-generated>

using System;
using UnityEngine;
using VisualScript.Icons;
using UnityEngine.UI;

namespace VisualScript.Runtime
{
    [Title("Rect Transform Set Pivot With Counter Adjust")]
    [Category("UI/Layout/Rect Transform/Set Pivot With Counter Adjust")]
    [Description("Executes the Set Pivot With Counter Adjust method on the Rect Transform component")]

    [Image(typeof(IconRectTransform), ColorTheme.Type.TextLight)]
    [Keywords("UI, Layout")]

    [Parameter("New Pivot")]
    [Parameter("Adjust Children")]

    [Serializable]
    public class GenInstructionRectTransform_SetPivotWithCounterAdjust_2 : Instruction
    {
        [SerializeField] private GetGameObject m_RectTransform = new GetGameObject(
            new GenTypeGameObject_RectTransform()
        );

        [SerializeField] private GetVector2 m_NewPivot = new GetVector2();

        [SerializeField] private GetBool m_AdjustChildren = new GetBool();

        protected override string GetTitle(GameObject source)
        {
            string method = TextUtils.ThemeAsKeyword("Set Pivot With Counter Adjust");
            return $"{this.m_RectTransform} {method} ({this.m_NewPivot}, {this.m_AdjustChildren})";
        }

        protected override Awaitable Run(Args args)
        {
            RectTransform component = this.m_RectTransform.Get<RectTransform>(args);
            if (component == null) return Done;

            component.SetPivotWithCounterAdjust(
                (Vector2) this.m_NewPivot.Get(args),
                (bool) this.m_AdjustChildren.Get(args)
            );

            return Done;
        }
    }
}
```

