Game Object Active in Hierarchy#
Game Object / Game Object Active in Hierarchy
Can Read
Cannot Write
Description#
The active state of the GameObject in the Scene hierarchy
Code#
using System;
using UnityEngine;
using VisualScript.Icons;
namespace VisualScript.Runtime
{
[Get]
[Title("Game Object Active in Hierarchy")]
[Category("Game Object/Active in Hierarchy")]
[Description("The active state of the GameObject in the Scene hierarchy")]
[Image(typeof(IconCubeOutline), ColorTheme.Type.TextLight, typeof(BadgeTick))]
[Keywords("Enabled", "Disabled", "Active", "Inactive", "Global")]
[Serializable]
public class TypeBoolGameObjectActiveInHierarchy : TypeBool
{
[SerializeField] private GetGameObject m_GameObject = new GetGameObject();
public override bool GetPreview(GameObject source)
{
GameObject gameObject = this.m_GameObject.GetPreview(source);
return gameObject != null && gameObject.activeInHierarchy;
}
public override bool Get(Args args)
{
GameObject gameObject = this.m_GameObject.Get(args);
return gameObject != null && gameObject.activeInHierarchy;
}
public override string ToString()
{
return $"{this.m_GameObject} Active";
}
protected override SubscriptionMode Subscription => SubscriptionMode.OnChange;
}
}