Skip to content

'enter' stage not called in some cases #1117

@Illthiriel

Description

@Illthiriel

Bevy version

bevy 0.4.0

Operating system & version

Windows 10

What you did

The following code allow to reproduce the issue. If I uncomment the add_stage_before line, the enter_system is not called anymore.

use bevy::prelude::*;

#[derive(Clone)]
pub enum AppState {
    Loading,
}

fn main() {
    App::build()
        .add_plugins(DefaultPlugins)
        .add_resource(State::new(AppState::Loading))
        // uncomment the next line and 'enter_system' is not called
        // .add_stage_before(stage::UPDATE, "STAGE_1", StateStage::<AppState>::default())
        .add_stage_after(stage::UPDATE, "STAGE_2", StateStage::<AppState>::default()
            .with_enter_stage(
                AppState::Loading,
                SystemStage::parallel()
                    .with_system(enter_system.system()),
            )
            .with_update_stage(
                AppState::Loading,
                SystemStage::parallel()
                    .with_system(update_system.system()),
            ))
        .run();
}

pub fn enter_system() {
    println!("enter_system");
}

pub fn update_system() {
    println!("update_system");
}

What you expected to happen

The 'enter' should be called.

What actually happened

The 'enter' is not called.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-ECSEntities, components, systems, and eventsC-BugAn unexpected or incorrect behavior

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions