Is Destroying Game Object#
Game Object / Is Destroying Game Object
Description#
Returns true if the Game Object does not exist or is currently flagged to be destroyed
Parameters#
| Name | Description |
|---|---|
| Game Object | The game object to check |
Code#
using System;
using UnityEngine;
using VisualScript.Icons;
namespace VisualScript.Runtime
{
[Title("Is Destroying Game Object")]
[Image(typeof(IconCubeSolid), ColorTheme.Type.TextLight, typeof(BadgeCross))]
[Description("Returns true if the Game Object does not exist or is currently flagged to be destroyed")]
[Category("Game Object/Is Destroying")]
[Parameter("Game Object", "The game object to check")]
[Keywords("Null", "Empty", "Valid")]
[Serializable]
public class ConditionCoreGameObjectIsDestroying : Condition
{
[SerializeField] private GetGameObject m_GameObject = new GetGameObject();
protected override string GetTitle(GameObject source) => $"Destroying {this.m_GameObject}";
protected override bool Run(Args args)
{
GameObject gameObject = this.m_GameObject.Get(args);
return gameObject == null || gameObject.IsDestroying();
}
}
}