FindMode InParent

robot_2Generated
code_blocksInput

Description

The InParent field of the FindMode enumeration specifies that the search for components should be conducted within the parent of the current object. This mode is useful when you need to locate components that are directly associated with the parent object, rather than the current object or its children.

Usage

Use the InParent field when you want to find components that are part of the parent object of the current context. This can be particularly useful in hierarchical structures where components are organized in a parent-child relationship, and you need to access or manipulate components at the parent level.

Example

// Example of using FindMode.InParent

// Assume 'currentObject' is a GameObject with a parent
Component parentComponent = currentObject.FindComponent<Component>(FindMode.InParent);

// This will search for a component of type 'Component' in the parent of 'currentObject'.