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. 
This commit is contained in:
parent
22d605c8df
commit
4b446c020e
@ -33,6 +33,11 @@ impl<R: ExtractResource> Plugin for ExtractResourcePlugin<R> {
|
||||
fn build(&self, app: &mut App) {
|
||||
if let Some(render_app) = app.get_sub_app_mut(RenderApp) {
|
||||
render_app.add_systems(ExtractSchedule, extract_resource::<R>);
|
||||
} else {
|
||||
bevy_utils::error_once!(
|
||||
"Render app did not exist when trying to add `extract_resource` for <{}>.",
|
||||
std::any::type_name::<R>()
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user