GetComponentInParent
7/14/25Less than 1 minute
GameObject.GetComponentInParent(TComponent type)
Retrieves the component of Type type in the GameObject or any of its parents.
Parameters:
| Name | Type | Description |
|---|---|---|
| type | TComponent | Type of component to find. |
Returns:
| type | Description |
|---|---|
| TComponent | Returns 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)
