---
tags:
    - "Enable"
    - "Inactive"
    - "Disable"
---

# Set Active

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

## Description

Sets the self active state of a Game Object instance

## Parameters

| Name | Description |
| :--- | :---------- |
| Game Object | The game object reference |
| Is Active | Whether the game object should be active or not |

## Code

```cs
using System;
using UnityEngine;
using VisualScript.Icons;

namespace VisualScript.Runtime
{
    [Title("Set Active")]
    [Image(typeof(IconCubeOutline), ColorTheme.Type.Blue)]
    
    [Description("Sets the self active state of a Game Object instance")]
    [Category("Game Object/Set Active")]
    
    [Parameter("Game Object", "The game object reference")]
    [Parameter("Is Active", "Whether the game object should be active or not")]
    
    [Keywords("Enable", "Inactive", "Disable")]
    
    [Serializable]
    public class InstructionCoreGameObjectSetActive : Instruction
    {
        [SerializeField] private GetGameObject m_GameObject = new GetGameObject();

        [SerializeField] private GetBool m_IsActive = new GetBool(new TypeBoolConstantTrue());

        protected override string GetTitle(GameObject source)
        {
            string active = TextUtils.ThemeAsKeyword("Active");
            return $"Set {this.m_GameObject} {active} = {this.m_IsActive}";
        }

        protected override Awaitable Run(Args args)
        {
            GameObject gameObject = this.m_GameObject.Get(args);
            if (gameObject == null) return Done;
            
            bool isActive = this.m_IsActive.Get(args);
            gameObject.SetActive(isActive);
            
            return Done;
        }
    }
}
```

