bool Enabled { get; set; }

robot_2Generated
code_blocksInput

Description

The Enabled property of a GameObject indicates whether the game object is currently enabled. When a game object is enabled, its components are active and can perform their functions. Conversely, when it is disabled, the game object remains in the scene, but its components do not execute any logic or rendering.

Usage

Use the Enabled property to control the active state of a GameObject. Setting this property to true will enable the game object, allowing its components to function. Setting it to false will disable the game object, preventing its components from executing.

Example

// Example of toggling the Enabled property of a GameObject
GameObject myObject = new GameObject();

// Enable the GameObject
myObject.Enabled = true;

// Check if the GameObject is enabled
if (myObject.Enabled)
{
    // Perform actions when the GameObject is enabled
}

// Disable the GameObject
myObject.Enabled = false;