Skip to content

Commit 15c9af5

Browse files
better error message & fix errors
1 parent 468791f commit 15c9af5

File tree

2 files changed

+9
-3
lines changed

2 files changed

+9
-3
lines changed

crates/bevy_render/src/camera/camera.rs

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ use bevy_window::{
3838
WindowScaleFactorChanged,
3939
};
4040
use core::ops::Range;
41+
use core::panic::Location;
4142
use derive_more::derive::From;
4243
use wgpu::{BlendState, TextureFormat, TextureUsages};
4344

@@ -326,9 +327,14 @@ pub struct Camera {
326327
pub sub_camera_view: Option<SubCameraView>,
327328
}
328329

329-
fn warn_on_no_render_graph(world: DeferredWorld, entity: Entity, _: ComponentId) {
330+
fn warn_on_no_render_graph(
331+
world: DeferredWorld,
332+
entity: Entity,
333+
_: ComponentId,
334+
caller: Option<&'static Location<'static>>,
335+
) {
330336
if !world.entity(entity).contains::<CameraRenderGraph>() {
331-
warn!("Entity {entity} has a `Camera` component, but it doesn't have a render graph configured. Consider adding a `Camera2d` or `Camera3d` component, or manually adding a `CameraRenderGraph` component if you need a custom render graph.");
337+
warn!("{}Entity {entity} has a `Camera` component, but it doesn't have a render graph configured. Consider adding a `Camera2d` or `Camera3d` component, or manually adding a `CameraRenderGraph` component if you need a custom render graph.", caller.map(|location|format!("{location}: ")).unwrap_or_default());
332338
}
333339
}
334340

crates/bevy_render/src/sync_component.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ impl<C: Component> Plugin for SyncComponentPlugin<C> {
3333
app.register_required_components::<C, SyncToRenderWorld>();
3434

3535
app.world_mut().register_component_hooks::<C>().on_remove(
36-
|mut world, entity, _component_id| {
36+
|mut world, entity, _component_id, _caller| {
3737
let mut pending = world.resource_mut::<PendingSyncEntity>();
3838
pending.push(EntityRecord::ComponentRemoved(entity));
3939
},

0 commit comments

Comments
 (0)