Rect Transform Set Anchors#
UI / Layout / Rect Transform / Rect Transform Set Anchors
Description#
Executes the Set Anchors method on the Rect Transform component
Parameters#
| Name | Description |
|---|---|
| Position |
Code#
// <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 Anchors")]
[Category("UI/Layout/Rect Transform/Set Anchors")]
[Description("Executes the Set Anchors method on the Rect Transform component")]
[Image(typeof(IconRectTransform), ColorTheme.Type.TextLight)]
[Keywords("UI, Layout")]
[Parameter("Position")]
[Serializable]
public class GenInstructionRectTransform_SetAnchors_1 : Instruction
{
[SerializeField] private GetGameObject m_RectTransform = new GetGameObject(
new GenTypeGameObject_RectTransform()
);
[SerializeField] private GetVector2 m_Position = new GetVector2();
protected override string GetTitle(GameObject source)
{
string method = TextUtils.ThemeAsKeyword("Set Anchors");
return $"{this.m_RectTransform} {method} ({this.m_Position})";
}
protected override Awaitable Run(Args args)
{
RectTransform component = this.m_RectTransform.Get<RectTransform>(args);
if (component == null) return Done;
component.SetAnchors(
(Vector2) this.m_Position.Get(args)
);
return Done;
}
}
}