Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding a state lets unrelated systems run twice after system sets v2 #1753

Closed
jakobhellermann opened this issue Mar 25, 2021 · 0 comments
Closed
Labels
A-ECS Entities, components, systems, and events C-Bug An unexpected or incorrect behavior
Milestone

Comments

@jakobhellermann
Copy link
Contributor

When adding a state after #1675 systems in the same stage get run twice.

use bevy::{app::ScheduleRunnerSettings, prelude::*};
use std::time::Duration;

#[derive(Clone, PartialEq, Eq, Debug, Hash)]
enum AppState { Main }

fn main() {
    App::build()
        .insert_resource(ScheduleRunnerSettings::run_loop(Duration::from_secs_f32(1.0 / 60.0)))
        .add_plugins(MinimalPlugins)
        .add_state(AppState::Main)
        .add_system(system.system())
        .run();
}

fn system() {
    println!("<user system runs>");
}

results in the following execution

run stage First
run stage Startup
run stage PreUpdate
run stage Update
<user system runs>
<user system runs>
run stage PostUpdate
run stage Last

Removing the .add_state or reverting #1675 fixes the issue, i.e. the system gets run only once.

ping @Ratysz

@alice-i-cecile alice-i-cecile added C-Bug An unexpected or incorrect behavior A-ECS Entities, components, systems, and events labels Mar 25, 2021
@alice-i-cecile alice-i-cecile added this to the Bevy 0.5 milestone Mar 25, 2021
@bors bors bot closed this as completed in 500d746 Mar 26, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-ECS Entities, components, systems, and events C-Bug An unexpected or incorrect behavior
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants