Skip to content

format

typescript
GameObject.GetComponentsInParent(type)

class: GameObject

description

Get all instances of a specified component type in a GameObject and all its parent GameObjects.

parameter

param_nametypedescription
typeComponentThe type of the component.

reture

typedescription
T|nullReturns an array containing all found instances of the component. If no components of the specified type are found, returns null.

code example