Description
The FindMode.InChildren
field is a member of the FindMode
enumeration in the Sandbox namespace. It specifies that the search for components should be conducted within the children of the current object. This mode is useful when you want to locate components that are directly nested under the current object in the hierarchy.
Usage
Use FindMode.InChildren
when you need to find components that are children of a specific GameObject. This is particularly useful in scenarios where you want to limit the search scope to immediate children, avoiding deeper hierarchy levels.
Example
// Example of using FindMode.InChildren
GameObject parentObject = ...; // Assume this is your parent GameObject
var childComponents = parentObject.FindComponents<Component>(FindMode.InChildren);
// This will retrieve all components that are direct children of the parentObject.