Documentation

Unity Engine


Unity Engine


EntityQueryDesc

Describes a query to find archetypes in terms of required, optional, and excluded components.
Read time 2 minutesLast updated a day ago

Definition

public class EntityQueryDesc : IEquatable<EntityQueryDesc>

Remarks

Define an EntityQueryDesc object to describe complex queries. Inside a system, pass an EntityQueryDesc object to ComponentSystemBase.GetEntityQuery 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, 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

AbsentExclude archetypes that contain these component types.
AllInclude archetypes that contain all of the component types in the All list.
AnyInclude archetypes that contain at least one (but possibly more) of the component types in the Any list.
DisabledInclude archetypes that contain these components, but only match entities where the component is disabled.
NoneInclude 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.
OptionsSpecialized query options.
PresentInclude archetypes that contain these component types, whether or not the component is enabled.

Methods

Method

Description

EqualsCompare to another object for equality.
GetHashCodeCompute the hash code for this object
ValidateRun consistency checks on a query description, and throw an exception if validation fails.

Operators

Operator

Description

operator ==Compare two instance for equality.
operator !=Compare two instance for inequality.