bevy icon indicating copy to clipboard operation
bevy copied to clipboard

Getting `QueryState` from immutable `World` reference

Open vil-mo opened this issue 1 year ago • 1 comments

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

vil-mo avatar Nov 19 '24 08:11 vil-mo

This partially resolves https://github.com/bevyengine/bevy/issues/3774 :)

alice-i-cecile avatar Nov 19 '24 16:11 alice-i-cecile

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.

alice-i-cecile avatar Mar 25 '25 20:03 alice-i-cecile