# IsComponentEnabled

> Checks whether a given IComponentData is enabled on the specified Entity. For the purposes of EntityQuery matching, an entity with a disabled component will behave as if it does not have that component.

## Definition

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

## IsComponentEnabled\<T>(ComponentTypeHandle\<T>, int)

Checks whether a given [IComponentData](/engine/7000.0/script-reference/unity/entities/icomponentdata.md) is enabled on the specified [Entity](/engine/7000.0/script-reference/unity/entities/entity.md). For the purposes of EntityQuery matching, an entity with a disabled component will behave as if it does not have that component.

```csharp
public readonly bool IsComponentEnabled<T>(ref ComponentTypeHandle<T> typeHandle, int entityIndexInChunk) where T : struct, IComponentData, IEnableableComponent
```

### Parameters

**** (\[ComponentTypeHandle\<T>]\(/engine/7000.0/script-reference/unity/entities/componenttypehandle1)): A type handle for the component type that will be queried.**** (\[int]\(https\://learn.microsoft.com/dotnet/api/system.int32)): The index within this chunk of the entity whose component should be checked.

### Returns

| Type                                                          | Description                                                                                                                         |
| ------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------- |
| [bool](https://learn.microsoft.com/dotnet/api/system.boolean) | True if the specified component is enabled, or false if it is disabled. Also returns false if the `T` is not present in this chunk. |

### Remarks

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

## IsComponentEnabled\<T>(BufferTypeHandle\<T>, int)

Checks whether a given [IBufferElementData](/engine/7000.0/script-reference/unity/entities/ibufferelementdata.md) is enabled on the specified [Entity](/engine/7000.0/script-reference/unity/entities/entity.md). For the purposes of EntityQuery matching, an entity with a disabled component will behave as if it does not have that component.

```csharp
public readonly bool IsComponentEnabled<T>(ref BufferTypeHandle<T> bufferTypeHandle, int entityIndexInChunk) where T : unmanaged, IBufferElementData, IEnableableComponent
```

### Parameters

**** (\[BufferTypeHandle\<T>]\(/engine/7000.0/script-reference/unity/entities/buffertypehandle1)): A type handle for the component type that will be queried.**** (\[int]\(https\://learn.microsoft.com/dotnet/api/system.int32)): The index within this chunk of the entity whose component should be checked.

### Returns

| Type                                                          | Description                                                                                                                                |
| ------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------ |
| [bool](https://learn.microsoft.com/dotnet/api/system.boolean) | True if the specified buffer component is enabled, or false if it is disabled. Also returns false if the `T` is not present in this chunk. |

### Remarks

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

## IsComponentEnabled(DynamicComponentTypeHandle, int)

Checks whether a given [IBufferElementData](/engine/7000.0/script-reference/unity/entities/ibufferelementdata.md) is enabled on the specified [Entity](/engine/7000.0/script-reference/unity/entities/entity.md). For the purposes of EntityQuery matching, an entity with a disabled component will behave as if it does not have that component.

```csharp
public readonly bool IsComponentEnabled(ref DynamicComponentTypeHandle typeHandle, int entityIndexInChunk)
```

### Parameters

**** (\[DynamicComponentTypeHandle]\(/engine/7000.0/script-reference/unity/entities/dynamiccomponenttypehandle)): A type handle for the component type that will be queried.**** (\[int]\(https\://learn.microsoft.com/dotnet/api/system.int32)): The index within this chunk of the entity whose component should be checked.

### Returns

| Type                                                          | Description                                                                                                                                |
| ------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------ |
| [bool](https://learn.microsoft.com/dotnet/api/system.boolean) | True if the specified buffer component is enabled, or false if it is disabled. Also returns false if the `T` is not present in this chunk. |

### Remarks

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