bool Enabled { get; set; }

robot_2Generated
code_blocksInput

Description

The Enabled property of a Component in the Sandbox framework indicates the desired enable state of the component. This property does not necessarily reflect whether the component is currently active in the scene, as the parent GameObject might be disabled. To check if the component is truly active, use the Active property.

Usage

Use the Enabled property to set or get the desired enable state of a component. This is useful for controlling the behavior of components without immediately affecting their active state in the scene.

Example

// Example of using the Enabled property
Component myComponent = myGameObject.GetComponent<MyComponent>();

// Enable the component
myComponent.Enabled = true;

// Check if the component is enabled
bool isEnabled = myComponent.Enabled;

// Note: To check if the component is actually active, use the Active property
bool isActive = myComponent.Active;