The GetInChildrenOrSelf
method is used to find a component of type T
on the immediate children of a game object or on the game object itself. This method is part of the ComponentList
class in the Sandbox framework.
The GetInChildrenOrSelf
method is used to find a component of type T
on the immediate children of a game object or on the game object itself. This method is part of the ComponentList
class in the Sandbox framework.
To use the GetInChildrenOrSelf
method, call it on an instance of ComponentList
. You can specify whether to include disabled components in the search by passing a boolean value to the includeDisabled
parameter.
// Example usage of GetInChildrenOrSelf ComponentList componentList = gameObject.GetComponentList(); MyComponentType component = componentList.GetInChildrenOrSelf<MyComponentType>(includeDisabled: true); if (component != null) { // Component found, perform operations }