jakobhellermann / bevy_editor_pls

In-App editor tools for bevy applications

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Closing primary window leaves secondary window intact

bayou-brogrammer opened this issue · comments

commented

If i use EditorPlugin::new().on_second_monitor_fullscreen() or EditorPlugin::new().in_new_window() then closing the primary window does not cause the app to shut down.

I don't know if this was intentional or not, but i figured I would mention it just in case. For my workaround, i just added a system to close bevy if the primary window ceases to exist

fn exit_on_primary_window_close(
    mut app_exit_events: EventWriter<AppExit>,
    primary_windows: Query<&Window, With<PrimaryWindow>>,
) {
    if primary_windows.is_empty() {
        log::info!("Primary window closed, exiting");
        app_exit_events.send(AppExit);
    }
}