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

Game Object / Set Active

Description#

Sets the self active state of a Game Object instance

Parameters#

Name Description
Game Object The game object reference
Is Active Whether the game object should be active or not

Code#

using System;
using UnityEngine;
using VisualScript.Icons;

namespace VisualScript.Runtime
{
    [Title("Set Active")]
    [Image(typeof(IconCubeOutline), ColorTheme.Type.Blue)]
    
    [Description("Sets the self active state of a Game Object instance")]
    [Category("Game Object/Set Active")]
    
    [Parameter("Game Object", "The game object reference")]
    [Parameter("Is Active", "Whether the game object should be active or not")]
    
    [Keywords("Enable", "Inactive", "Disable")]
    
    [Serializable]
    public class InstructionCoreGameObjectSetActive : Instruction
    {
        [SerializeField] private GetGameObject m_GameObject = new GetGameObject();

        [SerializeField] private GetBool m_IsActive = new GetBool(new TypeBoolConstantTrue());

        protected override string GetTitle(GameObject source)
        {
            string active = TextUtils.ThemeAsKeyword("Active");
            return $"Set {this.m_GameObject} {active} = {this.m_IsActive}";
        }

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