Documentation index for AI agents (llms.txt) A Markdown version of every page is available: request the page's source under /docs/, follow the "alternate" link in this page's head, or start from /llms.txt.
Visual Script logo Manual

Set Transform Parent#

Transform / Hierarchy / Set Transform Parent

Description#

Changes the hierarchy by setting the parent of a Transform

Parameters#

Name Description
Transform The Transform to change its parent
Parent Which is the new parent of the Transform

Code#

using System;
using UnityEngine;
using VisualScript.Icons;

namespace VisualScript.Runtime
{
    [Title("Set Transform Parent")]
    [Category("Transform/Hierarchy/Set Parent")]
    [Description("Changes the hierarchy by setting the parent of a Transform")]

    [Image(typeof(IconHanger), ColorTheme.Type.Lime)]
    [Keywords("Transform", "Reparent", "Hierarchy")]

    [Parameter("Transform", "The Transform to change its parent")]
    [Parameter("Parent", "Which is the new parent of the Transform")]

    [Serializable]
    public class InstructionTransformSetParent : Instruction
    {
        [SerializeField] private GetGameObject m_Transform = new GetGameObject();
        [SerializeField] private GetGameObject m_Parent = new GetGameObject();

        protected override string GetTitle(GameObject source)
        {
            string member = TextUtils.ThemeAsKeyword("Parent");
            return $"{this.m_Transform} {member} = {this.m_Parent}";
        }

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

            component.parent = this.m_Parent.Get<Transform>(args);
            return Done;
        }
    }
}
Visual Script logoVisual Script © Catsoft Works 2026. All rights reserved.