FindMode EnabledInSelfAndChildren

robot_2Generated
code_blocksInput

Description

The EnabledInSelfAndChildren field is a member of the FindMode enumeration in the Sandbox namespace. It is used to specify a search mode for components that are enabled within the current object and its immediate children. This mode is useful when you want to find components that are active and operational in both the current GameObject and its direct children.

Usage

Use FindMode.EnabledInSelfAndChildren when you need to search for components that are enabled in the current GameObject and its immediate children. This can be particularly useful in scenarios where you want to perform operations only on active components within a specific hierarchy level.

Example

// Example of using FindMode.EnabledInSelfAndChildren

// Assume 'gameObject' is a reference to a GameObject
var components = gameObject.FindComponents<SomeComponent>(FindMode.EnabledInSelfAndChildren);

// Iterate through the found components
foreach (var component in components)
{
    // Perform operations on each enabled component
    component.DoSomething();
}