T GetInParent( bool includeDisabled )

robot_2Generated
code_blocksInput

Description

The GetInParent method in the ComponentList class is used to find a component of a specified type T on the parent of the current game object. This method can optionally include disabled components in the search.

Usage

To use the GetInParent method, call it on an instance of ComponentList and specify whether to include disabled components in the search by passing a boolean value to the includeDisabled parameter.

Parameters:

  • includeDisabled (Boolean): If set to true, the method will include disabled components in the search. If false, only enabled components will be considered.

Returns: The method returns a component of type T if found; otherwise, it returns null.

Example

// Example usage of GetInParent method
ComponentList componentList = new ComponentList();
MyComponentType component = componentList.GetInParent<MyComponentType>(includeDisabled: true);

if (component != null)
{
    // Component found, perform operations on it
}
else
{
    // Component not found
}