diff --git a/crates/bevy_app/src/app.rs b/crates/bevy_app/src/app.rs index 7854eb207c849..ef7fe64c815a9 100644 --- a/crates/bevy_app/src/app.rs +++ b/crates/bevy_app/src/app.rs @@ -63,7 +63,7 @@ impl App { .run(&mut self.schedule, &mut self.world, &mut self.resources); } - pub fn run(mut self) { + pub fn initialize(&mut self) { self.startup_schedule .initialize(&mut self.world, &mut self.resources); self.startup_executor.initialize(&mut self.resources); @@ -72,7 +72,9 @@ impl App { &mut self.world, &mut self.resources, ); + } + pub fn run(mut self) { self.executor.initialize(&mut self.resources); let runner = std::mem::replace(&mut self.runner, Box::new(run_once)); (runner)(self); diff --git a/crates/bevy_app/src/schedule_runner.rs b/crates/bevy_app/src/schedule_runner.rs index 66c605b2f40f9..ad1509a3c1c64 100644 --- a/crates/bevy_app/src/schedule_runner.rs +++ b/crates/bevy_app/src/schedule_runner.rs @@ -55,6 +55,8 @@ impl Plugin for ScheduleRunnerPlugin { fn build(&self, app: &mut AppBuilder) { let run_mode = self.run_mode; app.set_runner(move |mut app: App| { + app.initialize(); + let mut app_exit_event_reader = EventReader::::default(); match run_mode { RunMode::Once => { diff --git a/crates/bevy_winit/src/lib.rs b/crates/bevy_winit/src/lib.rs index fd1a3626c9a79..afdb0e9449244 100644 --- a/crates/bevy_winit/src/lib.rs +++ b/crates/bevy_winit/src/lib.rs @@ -148,6 +148,8 @@ pub fn winit_runner(mut app: App) { &mut create_window_event_reader, ); + app.initialize(); + log::debug!("Entering winit event loop"); let should_return_from_run = app