Skip to content

Add a method to get EntityCommands from EntityWorldMut #23512

@Freyja-moth

Description

@Freyja-moth

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

Certain things, such as cloning components, are much easier to do with EntityCommands as opposed to EntityWorldMut. But currently switching between them is somewhat tedious.

let entity = entity_world.id()
entity_world.world_scope(|world| {
    world.commands().entity(entity);
});

What solution would you like?

A entity_commands (bikeshedding welcome) method on EntityWorldMut.

What alternative(s) have you considered?

Keep it as is. It's not that much extra code, and the only places where users would encounter this frustration (that I can think of) would be with EntityCommand and the upcoming Template .

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-ECSEntities, components, systems, and eventsC-UsabilityA targeted quality-of-life change that makes Bevy easier to useD-StraightforwardSimple bug fixes and API improvements, docs, test and examplesS-Ready-For-ImplementationThis issue is ready for an implementation PR. Go for it!X-UncontroversialThis work is generally agreed upon

    Type

    No type

    Projects

    Status

    Needs SME Triage

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions