# HasChunkComponent

> Reports whether this chunk contains a chunk component of the specified component type.

## Definition

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

## HasChunkComponent\<T>(ComponentTypeHandle\<T>)

Reports whether this chunk contains a chunk component of the specified component type.

```csharp
public readonly bool HasChunkComponent<T>(ref ComponentTypeHandle<T> typeHandle) where T : unmanaged, IComponentData
```

### Parameters

**** (\[ComponentTypeHandle\<T>]\(/engine/7000.0/script-reference/unity/entities/componenttypehandle1)): An object containing type and job safety information. To create this object, call [ComponentSystemBase.GetComponentTypeHandle](/engine/7000.0/script-reference/unity/entities/componentsystembase/getcomponenttypehandle.md). Pass the object to a job using a public field you define as part of the job struct.

### Returns

| Type                                                          | Description                                                           |
| ------------------------------------------------------------- | --------------------------------------------------------------------- |
| [bool](https://learn.microsoft.com/dotnet/api/system.boolean) | True, if this chunk contains a chunk component of the specified type. |

### Remarks

When an [EntityQuery](/engine/7000.0/script-reference/unity/entities/entityquery.md) includes optional components used as chunk components (with [EntityQueryBuilder.WithAny](/engine/7000.0/script-reference/unity/entities/entityquerybuilder/withany.md)), some chunks returned by the query may have these chunk components and some may not. Use this function to determine whether or not the current chunk contains one of these optional component types as a chunk component.

Additional Resources: [ArchetypeChunk.Has](/engine/7000.0/script-reference/unity/entities/archetypechunk/has.md)

## HasChunkComponent\<T>()

Reports whether this chunk contains a chunk component of the specified component type.

```csharp
public readonly bool HasChunkComponent<T>() where T : unmanaged, IComponentData
```

### Returns

| Type                                                          | Description                                                           |
| ------------------------------------------------------------- | --------------------------------------------------------------------- |
| [bool](https://learn.microsoft.com/dotnet/api/system.boolean) | True, if this chunk contains a chunk component of the specified type. |

### Remarks

When an [EntityQuery](/engine/7000.0/script-reference/unity/entities/entityquery.md) includes optional components used as chunk components (with [EntityQueryBuilder.WithAny](/engine/7000.0/script-reference/unity/entities/entityquerybuilder/withany.md)), some chunks returned by the query may have these chunk components and some may not. Use this function to determine whether or not the current chunk contains one of these optional component types as a chunk component.
