Game Object Exists#
Game Object / Game Object Exists
Description#
Returns true if the targeted Game Object exists and is not null
Parameters#
| Name | Description |
|---|---|
| Game Object | The Game Object targeted |
Code#
using System;
using UnityEngine;
using VisualScript.Icons;
namespace VisualScript.Runtime
{
[Title("Game Object Exists")]
[Image(typeof(IconCubeSolid), ColorTheme.Type.TextLight)]
[Description("Returns true if the targeted Game Object exists and is not null")]
[Category("Game Object/Exists")]
[Parameter("Game Object", "The Game Object targeted")]
[Keywords("Null", "Empty", "Valid")]
[Serializable]
public class ConditionCoreGameObjectExists : Condition
{
[SerializeField] private GetGameObject m_GameObject = new GetGameObject();
protected override string GetTitle(GameObject source) => $"{this.m_GameObject} Exists";
protected override bool Run(Args args)
{
GameObject gameObject = this.m_GameObject.Get(args);
return gameObject != null;
}
}
}