Skip to content

Add commands() method to ChildBuilder #2817

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

TheNeikos
Copy link
Contributor

@TheNeikos TheNeikos commented Sep 13, 2021

Objective

  • Have access to the Commands structure while constructing child entities

Solution

  • Expose the underlying Commands through a commands method on ChuildBuilder in a similar fashion to EntityCommands

@TheNeikos TheNeikos changed the title Add commands() method to ChuildBuilder Add commands() method to ChildBuilder Sep 13, 2021
@github-actions github-actions bot added the S-Needs-Triage This issue needs to be labelled label Sep 13, 2021
@TheNeikos TheNeikos force-pushed the feature/add_commands_to_childbuilder branch from d3dffb5 to 310d6be Compare September 13, 2021 11:00
@MinerSebas
Copy link
Contributor

#2448 was a previous PR attempt to add this method.
Could you explain why the objections there are not valid (any longer)/ What Usecase you have, that requires this change.

@TheNeikos
Copy link
Contributor Author

You are right, I'm sorry I should have checked the PRs if someone had tried to do something similar.

In my case I have a function that accepts a ChildBuilder and I need to insert something into the parent. Getting the commands at the same time would be rather cumbersome, so having the ChildBuilder expose its own commands would be better.

@alice-i-cecile alice-i-cecile added A-ECS Entities, components, systems, and events C-Usability A targeted quality-of-life change that makes Bevy easier to use and removed S-Needs-Triage This issue needs to be labelled labels Sep 14, 2021
@alice-i-cecile alice-i-cecile added the S-Needs-Design This issue requires design work to think about how it would best be accomplished label Sep 22, 2021
@alice-i-cecile
Copy link
Member

Closing in favor of #4708.

bors bot pushed a commit that referenced this pull request May 17, 2022
# Objective

Support returning data out of with_children to enable the use case of changing the parent commands with data created inside the child builder.

## Solution

Change the with_children closure to return T.

Closes #2817.

---

## Changelog

`BuildChildren::add_children` was added with the ability to return data to use outside the closure (for spawning a new child builder on a returned entity for example).
exjam pushed a commit to exjam/bevy that referenced this pull request May 22, 2022
# Objective

Support returning data out of with_children to enable the use case of changing the parent commands with data created inside the child builder.

## Solution

Change the with_children closure to return T.

Closes bevyengine#2817.

---

## Changelog

`BuildChildren::add_children` was added with the ability to return data to use outside the closure (for spawning a new child builder on a returned entity for example).
ItsDoot pushed a commit to ItsDoot/bevy that referenced this pull request Feb 1, 2023
# Objective

Support returning data out of with_children to enable the use case of changing the parent commands with data created inside the child builder.

## Solution

Change the with_children closure to return T.

Closes bevyengine#2817.

---

## Changelog

`BuildChildren::add_children` was added with the ability to return data to use outside the closure (for spawning a new child builder on a returned entity for example).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-ECS Entities, components, systems, and events C-Usability A targeted quality-of-life change that makes Bevy easier to use S-Needs-Design This issue requires design work to think about how it would best be accomplished
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants