# EntityQueryDesc

> Describes a query to find archetypes in terms of required, optional, and excluded components.

## Definition

* **Type:** Class
* **Namespace:** [Unity.Entities](/engine/7000.0/script-reference/unity/entities.md)
* **Assembly:** UnityEngine.EntitiesModule
* **Implements:** [IEquatable\<EntityQueryDesc>](https://learn.microsoft.com/dotnet/api/system.iequatable-1)

```csharp
public class EntityQueryDesc : IEquatable<EntityQueryDesc>
```

## Remarks

Define an EntityQueryDesc object to describe complex queries. Inside a system, pass an EntityQueryDesc object to [ComponentSystemBase.GetEntityQuery](/engine/7000.0/script-reference/unity/entities/componentsystembase/getentityquery.md) to create the [EntityQuery](/engine/7000.0/script-reference/unity/entities/entityquery.md).

A query description combines the component types you specify in `All`, `Any`, and `None` sets according to the following rules:

" All - Includes archetypes that have every component in this set " Any - Includes archetypes that have at least one component in this set " None - Excludes archetypes that have any component in this set, but includes entities which have the component disabled. " Disabled - Includes archetypes that have every component in this set, but only matches entities where the component is disabled. " Absent - Excludes archetypes that have any component in this set. " Present - Includes archetypes that have every component in this set, whether or not the component is enabled.

For example, given entities with the following components:

" Player has components: ObjectPosition, ObjectRotation, Player " Enemy1 has components: ObjectPosition, ObjectRotation, Melee

* Enemy2 has components: ObjectPosition, ObjectRotation, Ranger

The query description below matches all of the archetypes that: have any of \[Melee or Ranger], AND have none of \[Player], AND have all of \[ObjectPosition and ObjectRotation]

In other words, the query created from this description selects the Enemy1 and Enemy2 entities, but not the Player entity.

## Fields

| Value                                                                                  | Description                                                                                                                                                                                                              |
| -------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| [Absent](/engine/7000.0/script-reference/unity/entities/entityquerydesc/absent.md)     | Exclude archetypes that contain these component types.                                                                                                                                                                   |
| [All](/engine/7000.0/script-reference/unity/entities/entityquerydesc/all.md)           | Include archetypes that contain all of the component types in the All list.                                                                                                                                              |
| [Any](/engine/7000.0/script-reference/unity/entities/entityquerydesc/any.md)           | Include archetypes that contain at least one (but possibly more) of the component types in the Any list.                                                                                                                 |
| [Disabled](/engine/7000.0/script-reference/unity/entities/entityquerydesc/disabled.md) | Include archetypes that contain these components, but only match entities where the component is disabled.                                                                                                               |
| [None](/engine/7000.0/script-reference/unity/entities/entityquerydesc/none.md)         | Include archetypes that do not contain these component types. For enableable component types, archetypes with these components will still be matched by the query, but only for entities with these components disabled. |
| [Options](/engine/7000.0/script-reference/unity/entities/entityquerydesc/options.md)   | Specialized query options.                                                                                                                                                                                               |
| [Present](/engine/7000.0/script-reference/unity/entities/entityquerydesc/present.md)   | Include archetypes that contain these component types, whether or not the component is enabled.                                                                                                                          |

## Methods

| Method                                                                                       | Description                                                                                |
| -------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------ |
| [Equals](/engine/7000.0/script-reference/unity/entities/entityquerydesc/equals.md)           | Compare to another object for equality.                                                    |
| [GetHashCode](/engine/7000.0/script-reference/unity/entities/entityquerydesc/gethashcode.md) | Compute the hash code for this object                                                      |
| [Validate](/engine/7000.0/script-reference/unity/entities/entityquerydesc/validate.md)       | Run consistency checks on a query description, and throw an exception if validation fails. |

## Operators

| Operator                                                                                       | Description                          |
| ---------------------------------------------------------------------------------------------- | ------------------------------------ |
| [operator ==](/engine/7000.0/script-reference/unity/entities/entityquerydesc/op-equality.md)   | Compare two instance for equality.   |
| [operator !=](/engine/7000.0/script-reference/unity/entities/entityquerydesc/op-inequality.md) | Compare two instance for inequality. |
