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

Destroy#

Game Object / Creation / Destroy

Description#

Destroys a chosen instance of a game object

Parameters#

Name Description
Game Object The template game object that makes a copy

Code#

using System;
using UnityEngine;
using VisualScript.Icons;

namespace VisualScript.Runtime
{
    [Title("Destroy")]
    [Image(typeof(IconCubeOutline), ColorTheme.Type.TextLight, typeof(BadgeCross))]
    
    [Description("Destroys a chosen instance of a game object")]
    [Category("Game Object/Creation/Destroy")]
    
    [Parameter("Game Object", "The template game object that makes a copy")]
    
    [Keywords("Delete", "Remove", "Vanish")]
    
    [Serializable]
    public class InstructionCoreGameObjectDestroy : Instruction
    {
        [SerializeField] private GetGameObject m_GameObject = new GetGameObject();

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

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