mirror of
https://github.com/bevyengine/bevy
synced 2024-11-10 07:04:33 +00:00
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)
This commit is contained in:
parent
22d605c8df
commit
4b446c020e
1 changed files with 5 additions and 0 deletions
|
@ -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 a new issue