Skip to main content

LuaBehaviour.GetComponentInParent(TComponent t)

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

Parameters:

NameTypeDescription
tTComponentThe type of Component to retrieve.

Returns:

typeDescription
TComponentA component of the matching type, if found.

Usage

---@type LuaBehaviour
local luabehaviour;

---@type TComponent
local t;


local val0 = luabehaviour.GetComponentInParent(t)

Extra Detail

Recurses upwards until it finds a valid component. Returns null if no component found. Only components on active GameObjects are returned.