Skip to content
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

Return self from despawn_descendants #8883

Closed
Shatur opened this issue Jun 18, 2023 · 3 comments
Closed

Return self from despawn_descendants #8883

Shatur opened this issue Jun 18, 2023 · 3 comments
Labels
A-Hierarchy Parent-child entity hierarchies C-Usability A targeted quality-of-life change that makes Bevy easier to use D-Trivial Nice and easy! A great choice to get started with Bevy

Comments

@Shatur
Copy link
Contributor

Shatur commented Jun 18, 2023

What problem does this solve or what need does it fill?

Sometimes you want to despawn all descendants and insert new children. In order to do it you need to do something like this:

let mut entity = commands.entity(entity);
entity.despawn_descendants();
entity.with_children(|parent| {
    // Spawn new children.
});

What solution would you like?

It would be great to return self from despawn_descendants in order to do something like this:

commands.entity(entity).despawn_descendants().with_children(|parent| {
    // Spawn new children.
});
@Shatur Shatur added C-Feature A new feature, making something new possible S-Needs-Triage This issue needs to be labelled labels Jun 18, 2023
@alice-i-cecile alice-i-cecile added D-Trivial Nice and easy! A great choice to get started with Bevy C-Usability A targeted quality-of-life change that makes Bevy easier to use A-Hierarchy Parent-child entity hierarchies and removed C-Feature A new feature, making something new possible S-Needs-Triage This issue needs to be labelled labels Jun 19, 2023
@AnbyKatz
Copy link
Contributor

I wouldn't mind giving this one a go if its alright

@Shatur
Copy link
Contributor Author

Shatur commented Jun 21, 2023

@AnthonyKalaitzis feel free to do it!

github-merge-queue bot pushed a commit that referenced this issue Jun 23, 2023
# Objective

- Change despawn descendants to return self (#8883).

## Solution

- Change function signature `despawn_descendants` under trait
`DespawnRecursiveExt`.
- Add single extra test `spawn_children_after_despawn_descendants` (May
be unnecessary)

---------

Co-authored-by: Alice Cecile <alice.i.cecile@gmail.com>
@Shatur
Copy link
Contributor Author

Shatur commented Jun 23, 2023

Closed by #8928.

@Shatur Shatur closed this as completed Jun 23, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-Hierarchy Parent-child entity hierarchies C-Usability A targeted quality-of-life change that makes Bevy easier to use D-Trivial Nice and easy! A great choice to get started with Bevy
Projects
None yet
Development

No branches or pull requests

3 participants