Skip to main content

GameObject.GetComponentInParent(TComponent type)

Retrieves the component of Type type in the GameObject or any of its parents.

Parameters:

NameTypeDescription
typeTComponentType of component to find.

Returns:

typeDescription
TComponentReturns a component if a component matching the type is found. Returns nil otherwise.

Usage

---@type GameObject
local gameobject;

---@type TComponent
local type;


local val0 = gameobject.GetComponentInParent(type)