Run your app in headless mode for testing
Bevy version: 0.18Last 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::*;
use bevy::render::{
settings::{RenderCreation, WgpuSettings},
RenderPlugin,
};
fn main() {
App::new()
.add_plugins(DefaultPlugins.set(RenderPlugin {
synchronous_pipeline_compilation: true,
render_creation: RenderCreation::Automatic(WgpuSettings {
backends: None,
..default()
}),
..default()
}))
.run();
}