# GetComponentTypes

> Gets an entity's component types.

## Definition

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

## GetComponentTypes(Entity, Allocator)

Gets an entity's component types.

```csharp
public NativeArray<ComponentType> GetComponentTypes(Entity entity, Allocator allocator = Allocator.Temp)
```

### Parameters

**** (\[Entity]\(/engine/7000.0/script-reference/unity/entities/entity)): The entity.**** (\[Allocator]\(/engine/7000.0/script-reference/unity/collections/allocator)): The type of allocation for creating the NativeArray to hold the ComponentType objects.

### Returns

| Type                                                                                             | Description                                                                                  |
| ------------------------------------------------------------------------------------------------ | -------------------------------------------------------------------------------------------- |
| [NativeArray\<ComponentType>](/engine/7000.0/script-reference/unity/collections/nativearray1.md) | An array of ComponentType containing all the types of components associated with the entity. |

## GetComponentTypes(Entity, AllocatorHandle)

Gets an entity's component types.

```csharp
public NativeArray<ComponentType> GetComponentTypes(Entity entity, AllocatorManager.AllocatorHandle allocator)
```

### Parameters

**** (\[Entity]\(/engine/7000.0/script-reference/unity/entities/entity)): The entity.**** (\[AllocatorHandle]\(/engine/7000.0/script-reference/unity/collections/allocatormanager/allocatorhandle)): The type of allocation for creating the NativeArray to hold the ComponentType objects.

### Returns

| Type                                                                                             | Description                                                                                  |
| ------------------------------------------------------------------------------------------------ | -------------------------------------------------------------------------------------------- |
| [NativeArray\<ComponentType>](/engine/7000.0/script-reference/unity/collections/nativearray1.md) | An array of ComponentType containing all the types of components associated with the entity. |

## GetComponentTypes(SystemHandle, Allocator)

Gets a system entity's component types.

```csharp
public NativeArray<ComponentType> GetComponentTypes(SystemHandle system, Allocator allocator = Allocator.Temp)
```

### Parameters

**** (\[SystemHandle]\(/engine/7000.0/script-reference/unity/entities/systemhandle)): The system handle.**** (\[Allocator]\(/engine/7000.0/script-reference/unity/collections/allocator)): The type of allocation for creating the NativeArray to hold the ComponentType objects.

### Returns

| Type                                                                                             | Description                                                                                  |
| ------------------------------------------------------------------------------------------------ | -------------------------------------------------------------------------------------------- |
| [NativeArray\<ComponentType>](/engine/7000.0/script-reference/unity/collections/nativearray1.md) | An array of ComponentType containing all the types of components associated with the entity. |

## GetComponentTypes(SystemHandle, AllocatorHandle)

Gets a system entity's component types.

```csharp
public NativeArray<ComponentType> GetComponentTypes(SystemHandle system, AllocatorManager.AllocatorHandle allocator)
```

### Parameters

**** (\[SystemHandle]\(/engine/7000.0/script-reference/unity/entities/systemhandle)): The system handle.**** (\[AllocatorHandle]\(/engine/7000.0/script-reference/unity/collections/allocatormanager/allocatorhandle)): The type of allocation for creating the NativeArray to hold the ComponentType objects.

### Returns

| Type                                                                                             | Description                                                                                  |
| ------------------------------------------------------------------------------------------------ | -------------------------------------------------------------------------------------------- |
| [NativeArray\<ComponentType>](/engine/7000.0/script-reference/unity/collections/nativearray1.md) | An array of ComponentType containing all the types of components associated with the entity. |
