Version: Unity 7.0 Alpha (7000.0)
LanguageEnglish
  • C#

EntityQueryMask

struct in Unity.Entities

Suggest a change

Success!

Thank you for helping us improve the quality of Unity Documentation. Although we cannot accept all submissions, we do read each suggested change from our users and will make updates where applicable.

Close

Submission failed

For some reason your suggested change could not be submitted. Please <a>try again</a> in a few minutes. And thank you for taking the time to help us improve the quality of Unity Documentation.

Close

Cancel

Description

Provides an efficient test of whether a specific archetype is included in the set of archetypes matched by an EntityQuery.

Use a query mask to quickly identify whether an entity's archetype would be matched by an EntityQuery.



You can create up to 1024 unique EntityQueryMasks in an application.

Note that EntityQueryMask only filters by Archetype. It ignores any filtering on the EntityQuery (by shared component, change version, or order version), or the state of any enableable components.

One specific instance to be aware of is that if a query uses EntityQueryBuilder.WithNone with an enableable type T, an EntityQueryMask created from the query will effectively ignore this constraint. This is because for enableable types, WithNone matches both archetypes that don't contain T (as expected) but also those that do; entities in the latter archetypes could still match the query if their T component is disabled. Since EntityQueryMask ignores enableable component state, this means it considers an archetype to match whether or not it has T, meaning the WithNone(T) constraint has no effect. Consider using EntityQueryBuilder.WithAbsent in this case, if the intent is for the query mask to only match entities which don't have T at all.

Additional resources: EntityManager.GetEntityQueryMask

Public Methods

Method Description
Equals Compare this instance to another EntityQueryMask for equality.
GetHashCode Computes a hash code for this instance.
Matches Obsolete. Use EntityQueryMask.MatchesIgnoreFilter instead.
MatchesIgnoreFilter Reports whether an entity's archetype is in the set of archetypes matched by this query.

Operators

Operator Description
operator != Compare two instances for inequality.
operator == Compare two instances for equality.