FindMode InParent

book_4_sparkGenerated
code_blocksInput

Description

The FindMode.InParent field is a member of the FindMode enumeration in the Sandbox namespace. It specifies a mode for searching components within the parent of the current object. This is useful when you need to locate components that are directly attached to the parent GameObject of the current context.

Usage

Use FindMode.InParent when you want to search for components that are attached to the parent GameObject of the current object. This can be particularly useful in scenarios where the parent object holds shared components that need to be accessed by its children.

Example

// Example of using FindMode.InParent

// Assume 'this' is a Component
var parentComponent = this.GameObject.FindComponent<MyComponent>(FindMode.InParent);

if (parentComponent != null)
{
    // Do something with the parent component
}