# Has

> Reports whether this chunk contains the specified component type.

## Definition

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

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

Reports whether this chunk contains the specified component type.

```csharp
public readonly bool Has<T>(ref ComponentTypeHandle<T> typeHandle) where T : struct, 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 an array of the specified component type. |

### Remarks

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

## Has\<T>()

Reports whether this chunk contains the specified component type.

```csharp
public readonly bool Has<T>()
```

### Returns

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

### Remarks

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

## Has(DynamicComponentTypeHandle)

Reports whether this chunk contains the specified component type.

```csharp
public readonly bool Has(ref DynamicComponentTypeHandle typeHandle)
```

### Parameters

**** (\[DynamicComponentTypeHandle]\(/engine/7000.0/script-reference/unity/entities/dynamiccomponenttypehandle)): Type handle for the component type to query.

### Returns

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

## Has(TransformTypeHandle)

Reports whether this chunk contains the [TransformRef](/engine/7000.0/script-reference/unity/entities/transformref.md) type.

```csharp
public readonly bool Has(ref TransformTypeHandle typeHandle)
```

### Parameters

**** (\[TransformTypeHandle]\(/engine/7000.0/script-reference/unity/entities/transformtypehandle)): Type handle for the transform type.

### Returns

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

## Has\<T>(SharedComponentTypeHandle\<T>)

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

```csharp
public readonly bool Has<T>(SharedComponentTypeHandle<T> typeHandle) where T : struct, ISharedComponentData
```

### Parameters

**** (\[SharedComponentTypeHandle\<T>]\(/engine/7000.0/script-reference/unity/entities/sharedcomponenttypehandle1)): An object containing type and job safety information. To create this object, call [ComponentSystemBase.GetSharedComponentTypeHandle](/engine/7000.0/script-reference/unity/entities/componentsystembase/getsharedcomponenttypehandle.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 shared component of the specified type. |

### Remarks

When an [EntityQuery](/engine/7000.0/script-reference/unity/entities/entityquery.md) includes optional components used as shared components (with [EntityQueryBuilder.WithAny](/engine/7000.0/script-reference/unity/entities/entityquerybuilder/withany.md)), some chunks returned by the query may have these shared 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 shared component.

## Has(DynamicSharedComponentTypeHandle)

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

```csharp
public readonly bool Has(ref DynamicSharedComponentTypeHandle typeHandle)
```

### Parameters

**** (\[DynamicSharedComponentTypeHandle]\(/engine/7000.0/script-reference/unity/entities/dynamicsharedcomponenttypehandle)): An object containing type and job safety information. To create this object, call [ComponentSystemBase.GetDynamicSharedComponentTypeHandle](/engine/7000.0/script-reference/unity/entities/componentsystembase/getdynamicsharedcomponenttypehandle.md).

### Returns

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

### Remarks

When an [EntityQuery](/engine/7000.0/script-reference/unity/entities/entityquery.md) includes optional components used as shared components (with [EntityQueryBuilder.WithAny](/engine/7000.0/script-reference/unity/entities/entityquerybuilder/withany.md)), some chunks returned by the query may have these shared 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 shared component.

## Has\<T>(BufferTypeHandle\<T>)

Reports whether this chunk contains a dynamic buffer containing the specified component type.

```csharp
public readonly bool Has<T>(ref BufferTypeHandle<T> bufferTypeHandle) where T : unmanaged, IBufferElementData
```

### Parameters

**** (\[BufferTypeHandle\<T>]\(/engine/7000.0/script-reference/unity/entities/buffertypehandle1)): An object containing type and job safety information. To create this object, call [ComponentSystemBase.GetBufferTypeHandle](/engine/7000.0/script-reference/unity/entities/componentsystembase/getbuffertypehandle.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 an array of the dynamic buffers containing the specified component type. |

### Remarks

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