# GetComponentIndex()

> Gets the index of the component on its parent GameObject.

## Definition

* **Type:** Method
* **Namespace:** [UnityEngine](/engine/6000.7/script-reference/unityengine.md)
* **Assembly:** UnityEngine.CoreModule

```csharp
public int GetComponentIndex()
```

### Returns

| Type                                                       | Description          |
| ---------------------------------------------------------- | -------------------- |
| [int](https://learn.microsoft.com/dotnet/api/system.int32) | The component index. |
