---
tags:
    - "Enabled"
    - "Disabled"
    - "Active"
    - "Inactive"
    - "Global"
---

# Game Object Active in Hierarchy

[Game Object](index.md) / **Game Object Active in Hierarchy**

<div class="grid cards" markdown>

* :green_circle: Can Read

* :red_circle: Cannot Write

</div>

## Description

The active state of the GameObject in the Scene hierarchy

## Code

```cs
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;
    }
}
```

