-
-
Notifications
You must be signed in to change notification settings - Fork 3.7k
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
[Merged by Bors] - Adding WorldQuery
for WithBundle
#2024
Conversation
This addresses WithBundle missing WorldQuery implementation bevyengine#2023.
I wouldn't qualify that as a Bug, perhaps only as a surprise for Newbies. |
We've been discussing whether or not we should implicitly add "bundle marker components" to entities that were spawned with a Bundle. Then you could just check if something has Until then, I think WithBundle is a good middle ground. We could consider being a bit more explicit (ex: call it WithBundleComponents), but that is a pretty nasty name to look at / type. |
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 like it.
One point though: this negates current inline documentation of Bundle
. Could you please update https://github.com/bevyengine/bevy/blob/main/crates/bevy_ecs/src/bundle.rs#L15?
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.
The new example also needs to be added to the README.md
inside the examples Folder.
Co-authored-by: MinerSebas <66798382+MinerSebas@users.noreply.github.com>
Co-authored-by: MinerSebas <66798382+MinerSebas@users.noreply.github.com>
Co-authored-by: MinerSebas <66798382+MinerSebas@users.noreply.github.com>
…/bevy into add_query_bundle_example
This change disappeared and now I bring it back again.
If I don't add a single_threaded stage, I get printing (due to parallelism) that looks like this:
which is not great. I still haven't figured out how to make an App single_threaded or a SystemSet to be single threaded.. Or change an already included stage |
Our default answer to system order requirements is currently System Labels. Its slightly more boilerplate than a single threaded stage, but it has the benefit of:
|
Lets use labels with a new type deriving SystemLabel (see the link above for an example). |
Thanks for clarifying. I really needed this last two comments :P But here it is now. |
Made a few small tweaks to make the example even more minimal. |
I also adopted the |
Again, thanks so much. I've read all of your changes and will attempt to adhere to these standards next time. |
bors r+ |
In response to #2023, here is a draft for a PR. Fixes #2023 I've added an example to show how to use `WithBundle`, and also to test it out. Right now there is a bug: If a bundle and a query are "the same", then it doesn't filter out what it needs to filter out. Example: ``` Print component initated from bundle. [examples/ecs/query_bundle.rs:57] x = Dummy( <========= This should not get printed 111, ) [examples/ecs/query_bundle.rs:57] x = Dummy( 222, ) Show all components [examples/ecs/query_bundle.rs:50] x = Dummy( 111, ) [examples/ecs/query_bundle.rs:50] x = Dummy( 222, ) ``` However, it behaves the right way, if I add one more component to the bundle, so the query and the bundle doesn't look the same: ``` Print component initated from bundle. [examples/ecs/query_bundle.rs:57] x = Dummy( 222, ) Show all components [examples/ecs/query_bundle.rs:50] x = Dummy( 111, ) [examples/ecs/query_bundle.rs:50] x = Dummy( 222, ) ``` I hope this helps. I'm definitely up for tinkering with this, and adding anything that I'm asked to add or change. Co-authored-by: Carter Anderson <mcanders1@gmail.com>
Pull request successfully merged into main. Build succeeded: |
WorldQuery
for WithBundle
WorldQuery
for WithBundle
In response to bevyengine#2023, here is a draft for a PR. Fixes bevyengine#2023 I've added an example to show how to use `WithBundle`, and also to test it out. Right now there is a bug: If a bundle and a query are "the same", then it doesn't filter out what it needs to filter out. Example: ``` Print component initated from bundle. [examples/ecs/query_bundle.rs:57] x = Dummy( <========= This should not get printed 111, ) [examples/ecs/query_bundle.rs:57] x = Dummy( 222, ) Show all components [examples/ecs/query_bundle.rs:50] x = Dummy( 111, ) [examples/ecs/query_bundle.rs:50] x = Dummy( 222, ) ``` However, it behaves the right way, if I add one more component to the bundle, so the query and the bundle doesn't look the same: ``` Print component initated from bundle. [examples/ecs/query_bundle.rs:57] x = Dummy( 222, ) Show all components [examples/ecs/query_bundle.rs:50] x = Dummy( 111, ) [examples/ecs/query_bundle.rs:50] x = Dummy( 222, ) ``` I hope this helps. I'm definitely up for tinkering with this, and adding anything that I'm asked to add or change. Co-authored-by: Carter Anderson <mcanders1@gmail.com>
In response to bevyengine#2023, here is a draft for a PR. Fixes bevyengine#2023 I've added an example to show how to use `WithBundle`, and also to test it out. Right now there is a bug: If a bundle and a query are "the same", then it doesn't filter out what it needs to filter out. Example: ``` Print component initated from bundle. [examples/ecs/query_bundle.rs:57] x = Dummy( <========= This should not get printed 111, ) [examples/ecs/query_bundle.rs:57] x = Dummy( 222, ) Show all components [examples/ecs/query_bundle.rs:50] x = Dummy( 111, ) [examples/ecs/query_bundle.rs:50] x = Dummy( 222, ) ``` However, it behaves the right way, if I add one more component to the bundle, so the query and the bundle doesn't look the same: ``` Print component initated from bundle. [examples/ecs/query_bundle.rs:57] x = Dummy( 222, ) Show all components [examples/ecs/query_bundle.rs:50] x = Dummy( 111, ) [examples/ecs/query_bundle.rs:50] x = Dummy( 222, ) ``` I hope this helps. I'm definitely up for tinkering with this, and adding anything that I'm asked to add or change. Co-authored-by: Carter Anderson <mcanders1@gmail.com>
In response to #2023, here is a draft for a PR.
Fixes #2023
I've added an example to show how to use
WithBundle
, and also to test it out.Right now there is a bug: If a bundle and a query are "the same", then it doesn't filter out
what it needs to filter out.
Example:
However, it behaves the right way, if I add one more component to the bundle,
so the query and the bundle doesn't look the same:
I hope this helps. I'm definitely up for tinkering with this, and adding anything that I'm asked to add
or change.