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