# CompareComponents

> Obsolete. Use EntityQuery.CompareQuery instead.

## Definition

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

## CompareComponents(ComponentType\[])

Obsolete. Use [EntityQuery.CompareQuery](/engine/7000.0/script-reference/unity/entities/entityquery/comparequery.md) instead.

> **Warning:**
>
> **Deprecated.** This method is not Burst-compatible. Use CompareQuery(in EntityQueryBuilder queryDesc) instead. (RemovedAfter Entities 1.0)

```csharp
public bool CompareComponents(ComponentType[] componentTypes)
```

### Parameters

**** (\[ComponentType\[]]\(/engine/7000.0/script-reference/unity/entities/componenttype)): An array of ComponentType objects.

### Returns

| Type                                                          | Description                                                                                                                               |
| ------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------- |
| [bool](https://learn.microsoft.com/dotnet/api/system.boolean) | True, if the list of types, including any read/write access specifiers, matches the list of required component types of this EntityQuery. |

### Remarks

**Obsolete.** Use [EntityQuery.CompareQuery](/engine/7000.0/script-reference/unity/entities/entityquery/comparequery.md) instead.

Compares a list of component types to the types defining this EntityQuery. Only required types in the query are used as the basis for the comparison. If you include types that the query excludes or only includes as optional, the comparison returns false.

## CompareComponents(NativeArray\<ComponentType>)

Obsolete. Use [EntityQuery.CompareQuery](/engine/7000.0/script-reference/unity/entities/entityquery/comparequery.md) instead.

> **Warning:**
>
> **Deprecated.** Use CompareQuery(in EntityQueryBuilder queryDesc) instead. (RemovedAfter Entities 1.0)

```csharp
public bool CompareComponents(NativeArray<ComponentType> componentTypes)
```

### Parameters

**** (\[NativeArray\<ComponentType>]\(/engine/7000.0/script-reference/unity/collections/nativearray1)): An array of ComponentType objects.

### Returns

| Type                                                          | Description                                                                                                                               |
| ------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------- |
| [bool](https://learn.microsoft.com/dotnet/api/system.boolean) | True, if the list of types, including any read/write access specifiers, matches the list of required component types of this EntityQuery. |

### Remarks

**Obsolete.** Use [EntityQuery.CompareQuery](/engine/7000.0/script-reference/unity/entities/entityquery/comparequery.md) instead.

Compares a list of component types to the types defining this EntityQuery. Only required types in the query are used as the basis for the comparison. If you include types that the query excludes or only includes as optional, the comparison returns false. Do not include the [Entity](/engine/7000.0/script-reference/unity/entities/entity.md) type, which is included implicitly.
