-
-
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
Add the ability to append to a Bundle struct(or tuple) #1335
Comments
You can currently do this, which enables you to add components and bundles to spawned entities in a composable manner: commands
.spawn((Player, SomethingElse))
.with_bundle(SpriteBundle {...})
.with(SomeOtherComponent); |
oh, well, I did not know that, and currently finding info is kinda difficult without proper docs and tutorials... |
@RustyStriker, the docs are definitely lacking, but there are some good tutorials and unofficial docs listed on awesome-bevy. |
For anyone else who runs across this, check out #792, which discusses another issue / set of proposals along these same lines. |
Is the functionality described in #1570 adequate for this, or do we need another method? |
I think the new "nested bundles", plus "bundle merging" as described in #792 covers the desired use cases. I'm closing this, but feel free to continue the discussion here if anyone has other ideas. |
While learning the engine, i stumbled across a thing I believe is slowing down and forcing you to write more code than necessary, you cannot append to a Bundle.
I suggest adding the ability to add something to a Bundle struct, either by putting it in a tuple(which feels like the most intuitive solution) or any other way.
I managed to hack it around using a macro I found on: https://stackoverflow.com/questions/57454887/how-do-i-append-to-a-tuple
and added a function to the SpriteBundle which makes it into a tuple.
The idea is to prevent boiler code and have the ability to not repeat the same variables(like Transform) and use the Bundle types as a base so you could do something like:
commands.spawn((Player,SpriteBundle));
instead of:
commands.spawn((Player,Sprite,Mesh,...));
The text was updated successfully, but these errors were encountered: