From 4b446c020e476eadb5da2af923965946abdb826a Mon Sep 17 00:00:00 2001 From: Aevyrie Date: Sat, 27 Apr 2024 22:20:59 -0700 Subject: [PATCH] Add error when extract resource build fails (#4964) # Objective - Provide feedback when an extraction plugin fails to add its system. I had some troubleshooting pain when this happened to me, as the panic only tells you a resource is missing. This PR adds an error when the ExtractResource plugin is added before the render world exists, instead of silently failing. ![image](https://user-images.githubusercontent.com/2632925/172491993-673d9351-215a-4f30-96f7-af239c44686a.png) --- crates/bevy_render/src/extract_resource.rs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/crates/bevy_render/src/extract_resource.rs b/crates/bevy_render/src/extract_resource.rs index 30f6493d8f2a8..63a6c42dc4a20 100644 --- a/crates/bevy_render/src/extract_resource.rs +++ b/crates/bevy_render/src/extract_resource.rs @@ -33,6 +33,11 @@ impl Plugin for ExtractResourcePlugin { fn build(&self, app: &mut App) { if let Some(render_app) = app.get_sub_app_mut(RenderApp) { render_app.add_systems(ExtractSchedule, extract_resource::); + } else { + bevy_utils::error_once!( + "Render app did not exist when trying to add `extract_resource` for <{}>.", + std::any::type_name::() + ); } } }