GameObjectExtensions.HasComponentInParent

Extension Method in GameObjectExtensions

Declaration

public static bool HasComponentInParent(this GameObject gameObject, Type component)

Description

Checks if the game object has a component of the specified type on itself or any of its parents.

Parameters

gameObjectThe game object to check for the component.
componentThe type of component to check for.

Returns

boolTrue if the component exists, false otherwise.