From 4a1d0ddc28ae0206c820adf98254b264c86cad68 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois?= Date: Sat, 9 Mar 2024 00:38:56 +0100 Subject: [PATCH] CI testing: don't crash if screenshot manager resource is not available (#12385) # Objective - After #12370, ci testing with minimal plugins doesn't hang but it crash as the resource `ScreenshotManager` doesn't exist ## Solution - Check if the resource exists --- crates/bevy_dev_tools/src/ci_testing.rs | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/crates/bevy_dev_tools/src/ci_testing.rs b/crates/bevy_dev_tools/src/ci_testing.rs index 3f11a841c9372..c35288759468a 100644 --- a/crates/bevy_dev_tools/src/ci_testing.rs +++ b/crates/bevy_dev_tools/src/ci_testing.rs @@ -3,8 +3,9 @@ use bevy_app::{App, AppExit, Update}; use bevy_ecs::{ entity::Entity, - prelude::Resource, + prelude::{resource_exists, Resource}, query::With, + schedule::IntoSystemConfigs, system::{Local, Query, Res, ResMut}, }; use bevy_render::view::screenshot::ScreenshotManager; @@ -67,8 +68,13 @@ pub(crate) fn setup_app(app: &mut App) -> &mut App { ))); } - app.insert_resource(config) - .add_systems(Update, (ci_testing_exit_after, ci_testing_screenshot_at)); + app.insert_resource(config).add_systems( + Update, + ( + ci_testing_exit_after, + ci_testing_screenshot_at.run_if(resource_exists::), + ), + ); app }