Is Active in Hierarchy#
Game Object / Is Active in Hierarchy
Description#
Returns true if the Game Object is active in the scene hierarchy
Parameters#
| Name | Description |
|---|---|
| Game Object | The Game Object targeted |
Code#
using System;
using UnityEngine;
using VisualScript.Icons;
namespace VisualScript.Runtime
{
[Title("Is Active in Hierarchy")]
[Image(typeof(IconCubeOutline), ColorTheme.Type.TextLight)]
[Description("Returns true if the Game Object is active in the scene hierarchy")]
[Category("Game Object/Is Active in Hierarchy")]
[Parameter("Game Object", "The Game Object targeted")]
[Keywords("Enabled", "Active", "Disabled", "Inactive")]
[Serializable]
public class ConditionCoreGameObjectCompareIsActiveInHierarchy : Condition
{
[SerializeField] private GetGameObject m_GameObject = new GetGameObject();
protected override string GetTitle(GameObject source) => $"{this.m_GameObject} is Active in Hierarchy";
protected override bool Run(Args args)
{
GameObject gameObject = this.m_GameObject.Get(args);
return gameObject != null && gameObject.activeInHierarchy;
}
}
}