bevy
bevy copied to clipboard
Getting `QueryState` from immutable `World` reference
Objective
There is currently no way of getting QueryState from &World, so it is hard to, for example, iterate over all entities with a component, only having &World.
Solution
Add try_new function to QueryState that internally uses WorldQuery's get_state.
Testing
No testing
This partially resolves https://github.com/bevyengine/bevy/issues/3774 :)
Thank you to everyone involved with the authoring or reviewing of this PR! This work is relatively important and needs release notes! Head over to https://github.com/bevyengine/bevy-website/issues/1957 if you'd like to help out.