Getting QueryState from immutable World reference#16434
Merged
mockersf merged 5 commits intobevyengine:mainfrom Dec 1, 2024
Merged
Getting QueryState from immutable World reference#16434mockersf merged 5 commits intobevyengine:mainfrom
QueryState from immutable World reference#16434mockersf merged 5 commits intobevyengine:mainfrom
Conversation
Member
|
This partially resolves #3774 :) |
Member
alice-i-cecile
left a comment
There was a problem hiding this comment.
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?
alice-i-cecile
approved these changes
Nov 20, 2024
BenjaminBrienen
approved these changes
Nov 28, 2024
mockersf
approved these changes
Dec 1, 2024
ecoskey
pushed a commit
to ecoskey/bevy
that referenced
this pull request
Dec 2, 2024
# 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
ecoskey
pushed a commit
to ecoskey/bevy
that referenced
this pull request
Jan 6, 2025
# 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
Member
|
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. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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