# GetTypeIndex

> Fetches the TypeIndex for a given T.

## Definition

* **Type:** Method
* **Namespace:** [Unity.Entities](/engine/7000.0/script-reference/unity/entities.md)
* **Assembly:** UnityEngine.EntitiesModule

## GetTypeIndex\<T>()

Fetches the TypeIndex for a given T.

```csharp
public static TypeIndex GetTypeIndex<T>()
```

### Returns

| Type                                                                     | Description                                                                                                                                                             |
| ------------------------------------------------------------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| [TypeIndex](/engine/7000.0/script-reference/unity/entities/typeindex.md) | Returns the TypeIndex for the corresponding T component type. Otherwise [TypeIndex.Null](/engine/7000.0/script-reference/unity/entities/typeindex/null.md) is returned. |

## GetTypeIndex(Type)

Fetches the TypeIndex for a given System.Type.

```csharp
public static TypeIndex GetTypeIndex(Type type)
```

### Parameters

**** (\[Type]\(https\://learn.microsoft.com/dotnet/api/system.type)): A component type

### Returns

| Type                                                                     | Description                                                                                                                                                                       |
| ------------------------------------------------------------------------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| [TypeIndex](/engine/7000.0/script-reference/unity/entities/typeindex.md) | Returns the TypeIndex for the corresponding System.Type component type. Otherwise [TypeIndex.Null](/engine/7000.0/script-reference/unity/entities/typeindex/null.md) is returned. |
