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

Game Object Name#

Game Object / Game Object Name

  • Can Read

  • Can Write

Description#

The name of a Game Object

Code#

using System;
using UnityEngine;
using VisualScript.Icons;

namespace VisualScript.Runtime
{
    [Get, Set]
    
    [Title("Game Object Name")]
    [Category("Game Object/Name")]
    
    [Description("The name of a Game Object")]
    [Image(typeof(IconCubeOutline), ColorTheme.Type.Blue)]
    
    [Keywords("Game", "Object")]
    
    [Serializable]
    public class TypeStringGameObjectName : TypeString
    {
        [SerializeField] private GetGameObject m_GameObject;

        public override string GetPreview(GameObject source)
        {
            GameObject gameObject = m_GameObject.GetPreview(source);
            return gameObject != null ? gameObject.name : string.Empty;
        }

        public TypeStringGameObjectName() : this(new GetGameObject())
        { }
        
        public TypeStringGameObjectName(GetGameObject gameObject)
        {
            this.m_GameObject = gameObject;
        }

        public override string Get(Args args)
        {
            GameObject gameObject = this.m_GameObject.Get(args);
            return gameObject != null ? gameObject.name : string.Empty;
        }

        public override void Set(string value, Args args)
        {
            GameObject gameObject = this.m_GameObject.Get(args);
            if (gameObject != null) gameObject.name = value;
        }

        public override string ToString()
        {
            return $"{this.m_GameObject} Name";
        }

        protected override SubscriptionMode Subscription => SubscriptionMode.OnChange;
    }
}
Visual Script logoVisual Script © Catsoft Works 2026. All rights reserved.