Skip to content

EntityQuery refactor.#6446

Open
moonheart08 wants to merge 21 commits intospace-wizards:masterfrom
moonheart08:10-03-2026-enumerable-entity-query
Open

EntityQuery refactor.#6446
moonheart08 wants to merge 21 commits intospace-wizards:masterfrom
moonheart08:10-03-2026-enumerable-entity-query

Conversation

@moonheart08
Copy link
Contributor

@moonheart08 moonheart08 commented Mar 10, 2026

This makes EntityQuery usable in foreach loops, as a replacement for EntityQueryEnumerator<T> and AllEntityQueryEnumerator<T>.

Additionally, 2, 3, and 4 argument EntityQuery has been introduced.

you can finally

foreach (var ent in myQuery)
{
    // ...
}

and expect it to not only work but also be optimal (I verified that the generated IL is expectedly efficient, and does not allocate.)

This additionally starts work on introducing a "proper" query engine, with DynamicEntityQuery, which allows you to mark entries in the query as optional (i.e. allowed to not be present, but looked up regardless) or excluded (must not be present).

@moonheart08 moonheart08 changed the title Add an efficient enumerator impl to EntityQuery. EntityQuery refactor. Mar 10, 2026
@moonheart08 moonheart08 marked this pull request as ready for review March 10, 2026 22:47
@Tayrtahn Tayrtahn added the T: Refactor Type: Code refactor label Mar 15, 2026
@moonheart08 moonheart08 force-pushed the 10-03-2026-enumerable-entity-query branch from a17621e to 8b56561 Compare March 17, 2026 00:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

T: Refactor Type: Code refactor

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants