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 Name#

Game Object / Set Name

Description#

Sets the name of the Game Object instance

Parameters#

Name Description
Game Object The game object reference
Name The new name for the game object

Code#

using System;
using UnityEngine;
using VisualScript.Icons;

namespace VisualScript.Runtime
{
    [Title("Set Name")]
    [Image(typeof(IconCubeOutline), ColorTheme.Type.TextLight)]
    
    [Description("Sets the name of the Game Object instance")]
    [Category("Game Object/Set Name")]
    
    [Parameter("Game Object", "The game object reference")]
    [Parameter("Name", "The new name for the game object")]
    
    [Serializable]
    public class InstructionCoreGameObjectSetName : Instruction
    {
        [SerializeField] private GetGameObject m_GameObject = new GetGameObject();

        [SerializeField] private GetString m_Name = new GetString();

        protected override string GetTitle(GameObject source) => $"Set {this.m_GameObject} Name = {this.m_Name}";

        protected override Awaitable Run(Args args)
        {
            GameObject gameObject = this.m_GameObject.Get(args);
            if (gameObject == null) return Done;
            
            string name = this.m_Name.Get(args);
            gameObject.name = name;
            
            return Done;
        }
    }
}
Visual Script logoVisual Script © Catsoft Works 2026. All rights reserved.