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

Is Destroying Game Object#

Game Object / Is Destroying Game Object

  • Can Read

  • Cannot Write

Description#

Returns true if the game object does not exit or is currently flagged to be destroyed

Note

This instruction should only be used in the On Destroy event of a Game Object

Code#

using System;
using UnityEngine;
using VisualScript.Icons;

namespace VisualScript.Runtime
{
    [Get]
    
    [Title("Is Destroying Game Object")]
    [Category("Game Object/Is Destroying")]
    
    [Description("Returns true if the game object does not exit or is currently flagged to be destroyed")]
    [Image(typeof(IconCubeOutline), ColorTheme.Type.TextLight, typeof(BadgeCross))]
    
    [Note("This instruction should only be used in the On Destroy event of a Game Object")]
    
    [Serializable]
    public class TypeBoolGameObjectDestroying : TypeBool
    {
        [SerializeField] private GetGameObject m_GameObject = new GetGameObject();

        public override bool Get(Args args)
        {
            GameObject gameObject = this.m_GameObject.Get(args);
            return gameObject == null || gameObject.IsDestroying();
        }
        
        public override string ToString()
        {
            return $"{this.m_GameObject} is Destroying";
        }

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