-
-
Notifications
You must be signed in to change notification settings - Fork 4.2k
Description
What problem does this solve or what need does it fill?
I find myself occasionally want to check on game state in the way that I want to know if any entities of a given query exist already, but I don't need to use the actual query data. For instance whether the I button opens or closes the inventory window in my game depends on whether the inventory window is already open, and this is most directly checked by finding the marker component for the inventory window.
What solution would you like?
The quick solution would be simply a .empty() function on Query that returns true if the query matches no entities and false otherwise. More ideally I'd also like to be able to make a Query<(), (With<A>, Without<B>, Changed<C>)> so that no data is even passed to the function other than whether the query matches anything or not (having number of matches may be useful but I have no use cases for that currently)
What alternative(s) have you considered?
Currently I write my query like Query<Entity, (With<A>, Without<B>, Changed<C>)> and check on matches using query.iter().count() == 0 which is both wordy and not immediatly explicit. query.empty() would be much nicer