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

Bevy 0.10.1, crash when changing the exit condition #121

Closed
zwazel opened this issue Apr 1, 2023 · 3 comments · Fixed by #131
Closed

Bevy 0.10.1, crash when changing the exit condition #121

zwazel opened this issue Apr 1, 2023 · 3 comments · Fixed by #131

Comments

@zwazel
Copy link

zwazel commented Apr 1, 2023

In the newest bevy release, they fixed that the game crashes when changing the exit_condition in the WindowPlugin 7950. When trying to run my game with exit_condition being anything else than OnAllClosed, it crashes.

Interstingly, it first says 4 times that the loading state is done:
2023-04-01T11:07:27.685445Z INFO bevy_asset_loader::loading_state::systems: Loading state 'MainMenu' is done 2023-04-01T11:07:27.685494Z INFO bevy_asset_loader::loading_state::systems: Loading state 'MainMenu' is done 2023-04-01T11:07:27.685531Z INFO bevy_asset_loader::loading_state::systems: Loading state 'MainMenu' is done 2023-04-01T11:07:27.685561Z INFO bevy_asset_loader::loading_state::systems: Loading state 'MainMenu' is done

The error:
2023-04-01T11:07:27.686809Z WARN bevy_ecs::schedule::schedule: schedule with label LoadingStateSchedule(DoneLoadingMainMenu) not found thread 'main' panicked at 'The schedule with the label LoadingStateSchedule(DoneLoadingMainMenu) was not found.', C:\Users\zwaze\.cargo\registry\src\github.com-1ecc6299db9ec823\bevy_ecs-0.10.1\src\world\mod.rs:1743:32

@NiklasEi
Copy link
Owner

NiklasEi commented Apr 1, 2023

I cannot reproduce your error message, but I also get panics when changing the exit_condition. Thank you for the heads-up.

@zwazel
Copy link
Author

zwazel commented Apr 1, 2023

I made following mini bevy project, when I try to run it I get the same crash as mentioned before. Do you here also not get the error? And thanks a lot for this project btw, helps a lot :)

Cargo.toml:

[package]
name = "reproduce_exit_condition_crash"
version = "0.1.0"
edition = "2021"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
bevy = { version = "0.10.1" }
bevy_asset_loader = "0.16.0"

# Enable a small amount of optimization in debug mode
[profile.dev]
opt-level = 1

# Enable a lot of optimization in release mode
[profile.release]
codegen-units = 1

# Enable high optimizations for dependencies (incl. Bevy), but not for our code:
[profile.dev.package."*"]
opt-level = 3

main.rs:

use bevy::DefaultPlugins;
use bevy::prelude::*;
use bevy::window::ExitCondition;
use bevy_asset_loader::prelude::*;

#[derive(Debug, Clone, Copy, Default, Eq, PartialEq, Hash, States)]
enum AppState {
    #[default]
    LoadMainMenu,
    MainMenu,
}

fn main() {
    let mut app = App::new();
    app.add_state::<AppState>()
        .add_loading_state(
            LoadingState::new(AppState::LoadMainMenu)
                .continue_to_state(AppState::MainMenu),
        );

    app.add_plugins(DefaultPlugins.set(WindowPlugin {
        primary_window: Some(Window {
            title: format!("Reproduce Crash"),
            ..default()
        }),
        exit_condition: ExitCondition::DontExit, // Crash
        ..default()
    }));

    app.run();
}

@NiklasEi
Copy link
Owner

I investigated this a bit more last weekend. The underlying problem seems to be in Bevy 0.10 (see linked issue above).

I will fix it for bevy_asset_loader with a workaround, so we don't need to wait for Bevy 0.11.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants