bool Active { get; set; }

robot_2Generated
code_blocksInput

Description

Indicates whether the GameObject is active. A GameObject is considered active if it is enabled, all of its ancestor GameObjects are enabled, and it is part of a scene.

Usage

To check if a GameObject is active, access the Active property. This property is read-only and reflects the current state of the GameObject in the scene hierarchy.

Example

// Example of checking if a GameObject is active
GameObject myObject = new GameObject();
if (myObject.Active)
{
    // Perform actions if the GameObject is active
    // For example, enable a component or start an animation
}