diff --git a/examples/app/headless_renderer.rs b/examples/app/headless_renderer.rs index cf7d6732ba..cb11c42a0e 100644 --- a/examples/app/headless_renderer.rs +++ b/examples/app/headless_renderer.rs @@ -24,6 +24,7 @@ use bevy::{ texture::{BevyDefault, TextureFormatPixelInfo}, Extract, Render, RenderApp, RenderSet, }, + winit::WinitPlugin, }; use crossbeam_channel::{Receiver, Sender}; use std::{ @@ -81,16 +82,20 @@ fn main() { .add_plugins( DefaultPlugins .set(ImagePlugin::default_nearest()) - // Do not create a window on startup. + // Not strictly necessary, as the inclusion of ScheduleRunnerPlugin below + // replaces the bevy_winit app runner and so a window is never created. .set(WindowPlugin { primary_window: None, - exit_condition: bevy::window::ExitCondition::DontExit, - close_when_requested: false, - }), + ..default() + }) + // WinitPlugin will panic in environments without a display server. + .disable::(), ) .add_plugins(ImageCopyPlugin) // headless frame capture .add_plugins(CaptureFramePlugin) + // ScheduleRunnerPlugin provides an alternative to the default bevy_winit app runner, which + // manages the loop without creating a window. .add_plugins(ScheduleRunnerPlugin::run_loop( // Run 60 times per second. Duration::from_secs_f64(1.0 / 60.0),