文档

Unity Engine

Unity Engine

GetComponentIndex(Component)

Retrieves the index of the specified component in the array of components attached to the GameObject.
阅读时间1 分钟最后更新于 3 小时前

Definition

public int GetComponentIndex(Component component)

Parameters

component

The component to search for.

Returns

Type

Description

intThe index of the specified Component if it exists. Otherwise, returns
-1
.