FindMode DisabledInSelfAndDescendants

book_4_sparkGenerated
code_blocksInput

Description

The DisabledInSelfAndDescendants field is a member of the FindMode enumeration in the Sandbox namespace. This enumeration is used to specify the mode of searching for components within a hierarchy of game objects. The DisabledInSelfAndDescendants mode specifically targets components that are disabled within the current game object and all of its descendant objects.

Usage

Use the DisabledInSelfAndDescendants field when you need to find components that are not active in the current game object and its entire hierarchy of children. This can be useful for operations where you need to manipulate or inspect components that are not currently enabled.

Example

// Example of using FindMode.DisabledInSelfAndDescendants

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

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