Skip to content

Add a first query filter #18999

Open
Open
@Freyja-moth

Description

@Freyja-moth

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

There's no way to currently get the first entity that matches a given query from a SystemParameter.

What solution would you like?

Something like this

fn destroy_first(wall: First<Entity, With<Wall>>, mut commands: Commands) {
    let entity = wall.into_inner();

    commands.entity(entity).despawn();
} 

What alternative(s) have you considered?

Just using a query and taking the first from the iterator.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-ECSEntities, components, systems, and eventsC-FeatureA new feature, making something new possibleS-Nominated-To-CloseA triage team member thinks this PR or issue should be closed out.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions