Skip to content

Add ReplaceChildren and ClearChildren EntityCommands #5859

Closed
@taladar

Description

@taladar

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

We have AddChildren, InsertChildren, PushChildren and RemoveChildren but sometimes you just want to remove or replace
all existing children without caring what their Entity value is.

What solution would you like?

I would propose the addition of a ClearChildren EntityCommand to remove all children from a parent Entity and a ReplaceChildren command which basically combines this with PushChildren. Potentially a variant of the latter which uses a ChildBuilder might be useful as well though I am not sure about the naming conventions used here.

What alternative(s) have you considered?

It is possible to do this with RemoveChildren but for that we first need to retrieve all existing child Entitys in a separate query (which is especially annoying if we are in a utility function).

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-UsabilityA targeted quality-of-life change that makes Bevy easier to useD-TrivialNice and easy! A great choice to get started with Bevy

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions