# HasComponent

> Checks whether an entity has a specific type of component.

## Definition

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

## HasComponent\<T>(Entity)

Checks whether an entity has a specific type of component.

```csharp
public bool HasComponent<T>(Entity entity)
```

### Parameters

**** (\[Entity]\(/engine/7000.0/script-reference/unity/entities/entity)): The Entity object.

### Returns

| Type                                                          | Description                                      |
| ------------------------------------------------------------- | ------------------------------------------------ |
| [bool](https://learn.microsoft.com/dotnet/api/system.boolean) | True, if the specified entity has the component. |

### Remarks

Always returns false for an entity that has been destroyed.

## HasComponent\<T>(SystemHandle)

Checks whether an entity associated with a system has a specific type of component.

```csharp
public bool HasComponent<T>(SystemHandle system)
```

### Parameters

**** (\[SystemHandle]\(/engine/7000.0/script-reference/unity/entities/systemhandle)): The system handle.

### Returns

| Type                                                          | Description                                             |
| ------------------------------------------------------------- | ------------------------------------------------------- |
| [bool](https://learn.microsoft.com/dotnet/api/system.boolean) | True, if the specified system entity has the component. |

### Remarks

Always returns false for an entity that has been destroyed.

## HasComponent(Entity, ComponentType)

Checks whether an entity has a specific type of component.

```csharp
public bool HasComponent(Entity entity, ComponentType type)
```

### Parameters

**** (\[Entity]\(/engine/7000.0/script-reference/unity/entities/entity)): The Entity object.**** (\[ComponentType]\(/engine/7000.0/script-reference/unity/entities/componenttype)): The data type of the component.

### Returns

| Type                                                          | Description                                      |
| ------------------------------------------------------------- | ------------------------------------------------ |
| [bool](https://learn.microsoft.com/dotnet/api/system.boolean) | True, if the specified entity has the component. |

### Remarks

Always returns false for an entity that has been destroyed.

## HasComponent(SystemHandle, ComponentType)

Checks whether an entity associated with a system has a specific type of component.

```csharp
public bool HasComponent(SystemHandle system, ComponentType type)
```

### Parameters

**** (\[SystemHandle]\(/engine/7000.0/script-reference/unity/entities/systemhandle)): The system handle.**** (\[ComponentType]\(/engine/7000.0/script-reference/unity/entities/componenttype)): The data type of the component.

### Returns

| Type                                                          | Description                                             |
| ------------------------------------------------------------- | ------------------------------------------------------- |
| [bool](https://learn.microsoft.com/dotnet/api/system.boolean) | True, if the specified system entity has the component. |

### Remarks

Always returns false for an entity that has been destroyed.
