Skip to content

格式

typescript
GameObject.GetComponentsInParent(type)

所属类: GameObject

描述

获取指定类型的组件在一个GameObject及其所有父级GameObject中的实例。

参数

参数名类型描述
typeComponent组件类型

返回值

类型描述
T|null返回一个包含所有找到的组件实例的数组,如果没有该类型的组件,则返回null

代码示例