Skip to content

A way to determine if an entity exists with Commands #5850

Closed
@asafigan

Description

@asafigan

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

Some times you may be trying to work with entities that may or may not exist anymore. It would be helpful to have a way of determining is an entity exists with Commands

What solution would you like?

Add a get_entity() method on Commands that returns an Option<EntityCommands>.

Maybe a entity_exists() method on Commands that return a bool.

What alternative(s) have you considered?

You could have a Query<Entity> and check it before calling entity() on Commands.

Additional context

There are a lot of issues about handling command errors: #2004, #3845, #2241, #5617.

I feel like this would still be useful even with command error handling.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-ECSEntities, components, systems, and eventsC-FeatureA new feature, making something new possibleD-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