Class EntityQueryDesc
Describes a query to find archetypes in terms of required, optional, and excluded components.
Namespace: Unity.Entities
Syntax
public class EntityQueryDesc : IEquatable<EntityQueryDesc>
Remarks
Define an EntityQueryDesc object to describe complex queries. Inside a system, pass an EntityQueryDesc object to GetEntityQuery(EntityQueryDesc[]) to create the EntityQuery.
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
For example, given entities with the following components:
- Player has components: Position, Rotation, Player
- Enemy1 has components: Position, Rotation, Melee
- Enemy2 has components: Position, Rotation, 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 [Position and Rotation]
EntityQueryDesc description = new EntityQueryDesc
{
Any = new ComponentType[] { typeof(Melee), typeof(Ranger) },
None = new ComponentType[] { typeof(Player) },
All = new ComponentType[] { typeof(Position), typeof(Rotation) }
};
In other words, the query created from this description selects the Enemy1 and Enemy2 entities, but not the Player entity.
Fields
Name | Description |
---|---|
All | Include archetypes that contain all of the component types in the All list. |
Any | Include archetypes that contain at least one (but possibly more) of the component types in the Any list. |
None | Exclude archetypes that contain any of the component types in the None list. |
Options | Specialized query options. |
Methods
Name | Description |
---|---|
Equals(Object) | |
Equals(EntityQueryDesc) | |
GetHashCode() | |
Validate() |
Operators
Name | Description |
---|---|
Equality(EntityQueryDesc, EntityQueryDesc) | |
Inequality(EntityQueryDesc, EntityQueryDesc) |