Transform Set Parent#
Transform / Hierarchy / Transform Set Parent Parent, WorldPositionStays
Description#
Changes the parent of the transform
Parameters#
| Name | Description |
|---|---|
| Parent | |
| World Position Stays |
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;
namespace VisualScript.Runtime
{
[Title("Transform Set Parent")]
[Category("Transform/Hierarchy/Set Parent", "Parent, WorldPositionStays")]
[Description("Changes the parent of the transform")]
[Image(typeof(IconHanger), ColorTheme.Type.Lime)]
[Keywords("Transform")]
[Parameter("Parent")]
[Parameter("World Position Stays")]
[Serializable]
public class GenInstructionTransform_SetParent_2_TransformParent_BoolWorldPositionStays : Instruction
{
[SerializeField] private GetGameObject m_Transform = new GetGameObject(
new GenTypeGameObject_Transform()
);
[SerializeField] private GetGameObject m_Parent = new GetGameObject();
[SerializeField] private GetBool m_WorldPositionStays = new GetBool();
protected override string GetTitle(GameObject source)
{
string method = TextUtils.ThemeAsKeyword("Set Parent");
return $"{this.m_Transform} {method} ({this.m_Parent}, {this.m_WorldPositionStays})";
}
protected override Awaitable Run(Args args)
{
Transform component = this.m_Transform.Get<Transform>(args);
if (component == null) return Done;
component.SetParent(
(Transform) this.m_Parent.Get<Transform>(args),
(bool) this.m_WorldPositionStays.Get(args)
);
return Done;
}
}
}