-
-
Notifications
You must be signed in to change notification settings - Fork 4.3k
Getting QueryState from immutable World reference
#16434
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
This partially resolves #3774 :) |
alice-i-cecile
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd prefer to return results everywhere in this chain to improve debugging, but this is a very useful workaround currently.
That should be done in follow-up, but for now, can you add World::try_query + try_query_filtered methods to make this easier to use?
# 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
# 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
|
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 bevyengine/bevy-website#1957 if you'd like to help out. |
Objective
There is currently no way of getting
QueryStatefrom&World, so it is hard to, for example, iterate over all entities with a component, only having&World.Solution
Add
try_newfunction toQueryStatethat internally usesWorldQuery'sget_state.Testing
No testing