Sometimes a user may want to create a single-use query and dispose of it immediately. .Each()/.Iter()/.Run() should be updated to return the query being iterated to make disposing of one-off queries easier.
Currently the recommended pattern to create a single-use query looks like this.
using Query<Position> query = world.Query<Position>();
query.Each((ref Position p) =>
{
p.X++;
p.Y++;
});
It is nicer to be able to do something like this.
using Query<Position> query = world.Query<Position>()
.Each((ref Position p) =>
{
p.X++;
p.Y++;
});
Sometimes a user may want to create a single-use query and dispose of it immediately. .Each()/.Iter()/.Run() should be updated to return the query being iterated to make disposing of one-off queries easier.
Currently the recommended pattern to create a single-use query looks like this.
It is nicer to be able to do something like this.