Move Window creation to PreStartup

This commit is contained in:
Jan Hohenheim 2025-07-07 22:33:24 +02:00
parent 74b6a118b5
commit e37a5bcfc7
No known key found for this signature in database

View File

@ -19,6 +19,7 @@ extern crate alloc;
use alloc::sync::Arc; use alloc::sync::Arc;
use bevy_ecs::system::Commands;
use bevy_platform::sync::Mutex; use bevy_platform::sync::Mutex;
mod event; mod event;
@ -134,10 +135,9 @@ impl Plugin for WindowPlugin {
.add_event::<AppLifecycle>(); .add_event::<AppLifecycle>();
if self.spawn_primary_window { if self.spawn_primary_window {
app.world_mut().spawn(( app.add_systems(PreStartup, |mut commands: Commands| {
PrimaryWindow, commands.spawn(PrimaryWindow);
RawHandleWrapperHolder(Arc::new(Mutex::new(None))), });
));
} }
match self.exit_condition { match self.exit_condition {