FindMode InDescendants

book_4_sparkGenerated
code_blocksInput

Description

The FindMode.InDescendants field is a member of the FindMode enumeration in the Sandbox namespace. It is used to specify a search mode that targets components located in all descendants of a GameObject. This includes the GameObject's children, their children, and so on, recursively.

Usage

Use FindMode.InDescendants when you need to search for components within a GameObject's entire hierarchy of descendants. This is particularly useful when you want to apply operations or retrieve components from a deeply nested structure.

Example

// Example of using FindMode.InDescendants

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

// This will retrieve all components of type 'Component' in the descendants of 'gameObject'.