-
-
Notifications
You must be signed in to change notification settings - Fork 3.8k
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 a with_child
method to BuildChildren
#6712
Labels
A-UI
Graphical user interfaces, styles, layouts, and widgets
C-Usability
A targeted quality-of-life change that makes Bevy easier to use
Comments
bors bot
pushed a commit
that referenced
this issue
Nov 28, 2022
# Objective - Adding a single child is very cumbersome, and requires the use of a complex closure. - Fixes #6712. ## Solution Add a `with_child(b: impl Bundle)` API. ## Changelog Added `EntityCommands::with_child(b: impl Bundle)` and an equivelent method on `EntityMut` (for direct world access). ## Migration Guide When spawning a single child with no children of its own, consider using `commands.entity(parent).with_child(child_bundle)` to make your code clearer.
bors bot
pushed a commit
that referenced
this issue
Nov 28, 2022
# Objective - Adding a single child is very cumbersome, and requires the use of a complex closure. - Fixes #6712. ## Solution Add a `with_child(b: impl Bundle)` API. ## Changelog Added `EntityCommands::with_child(b: impl Bundle)` and an equivelent method on `EntityMut` (for direct world access). ## Migration Guide When spawning a single child with no children of its own, consider using `commands.entity(parent).with_child(child_bundle)` to make your code clearer.
bors bot
pushed a commit
that referenced
this issue
Nov 28, 2022
# Objective - Adding a single child is very cumbersome, and requires the use of a complex closure. - Fixes #6712. ## Solution Add a `with_child(b: impl Bundle)` API. ## Changelog Added `EntityCommands::with_child(b: impl Bundle)` and an equivelent method on `EntityMut` (for direct world access). ## Migration Guide When spawning a single child with no children of its own, consider using `commands.entity(parent).with_child(child_bundle)` to make your code clearer.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
A-UI
Graphical user interfaces, styles, layouts, and widgets
C-Usability
A targeted quality-of-life change that makes Bevy easier to use
When reviewing #6535, I noticed that calling
.build_children
with a single child is quite onerous.We should have the follow method on the
BuildChildren
trait:This allows users to quickly add single children without worrying about a closure, or even chain the method repeatedly if they just want to add a fixed number of children.
The text was updated successfully, but these errors were encountered: