Run your app in headless mode for testing
Bevy version: 0.19Last updated:
When testing, we often want to run our app without rendering anything to the screen. We can disable the rendering pipeline and run only our game logic.
This will load everything your game would normally have, but then not run any of the rendering pipeline.
use bevy::{
prelude::*,
render::{
RenderPlugin,
settings::{
RenderCreation,
WgpuSettings,
},
},
};
fn main() {
App::new()
.add_plugins(DefaultPlugins.set(RenderPlugin {
synchronous_pipeline_compilation: true,
render_creation: RenderCreation::Automatic(Box::new(WgpuSettings {
backends: None,
..default()
})),
..default()
}))
.run();
}