-
Notifications
You must be signed in to change notification settings - Fork 2
CursorQuery
Martin Evans edited this page Apr 14, 2025
·
2 revisions
A cursor query executes a query until a certain number of entities have been processed. Once this limit is hit a cursor is returned which allows the query to be resumed from that point.
The limit is not exact. The query will check every time it finishes processing an entire chunk (up to 1024 entities) if the budget has been exceeded.
If enough entities are deleted such that an entire chunk becomes empty (and is removed from the archetype) this may cause some entities in the adjacent chunk to be missed. If a chunk is only partially full and new entities are added to it, they will also be missed.
// Create a cursor with budget
var cursor = new Cursor
{
EntityBudget = Archetype.CHUNK_SIZE,
};
// Execute query with cursor
var inc = new Increment();
w.Execute<Increment, ComponentInt32>(ref inc, ref q, cursor);