Skip to content

DespawnOnEnter/DespawnOnExit no longer working on Observers #21579

@Ceedrich

Description

@Ceedrich

Bevy version and features

Version 0.17

What you did

Since #20204, can no longer be despawned by using the DespawnOnEnter/DespawnOnExit components. This is due to them being Internal entities and thus they are not queried in the systems responsible for despawning entities.

pub fn despawn_entities_on_exit_state<S: States>(
mut commands: Commands,
mut transitions: MessageReader<StateTransitionEvent<S>>,
query: Query<(Entity, &DespawnOnExit<S>)>,
) {

pub fn despawn_entities_on_enter_state<S: States>(
mut commands: Commands,
mut transitions: MessageReader<StateTransitionEvent<S>>,
query: Query<(Entity, &DespawnOnEnter<S>)>,
) {

Is this intended or should observers be able to be despawned?

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-ECSEntities, components, systems, and eventsC-BugAn unexpected or incorrect behaviorD-StraightforwardSimple bug fixes and API improvements, docs, test and examplesP-RegressionFunctionality that used to work but no longer does. Add a test for this!S-Ready-For-ImplementationThis issue is ready for an implementation PR. Go for it!

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions