diff --git a/crates/bevy_ui/src/render/box_shadow.rs b/crates/bevy_ui/src/render/box_shadow.rs index 4521f1854677a..515e06101581b 100644 --- a/crates/bevy_ui/src/render/box_shadow.rs +++ b/crates/bevy_ui/src/render/box_shadow.rs @@ -251,10 +251,11 @@ pub fn extract_shadows( >, mapping: Extract>, ) { + let default_camera_entity = default_ui_camera.get(); + for (entity, uinode, transform, view_visibility, box_shadow, clip, camera) in &box_shadow_query { - let Some(camera_entity) = camera.map(TargetCamera::entity).or(default_ui_camera.get()) - else { + let Some(camera_entity) = camera.map(TargetCamera::entity).or(default_camera_entity) else { continue; }; diff --git a/crates/bevy_ui/src/render/debug_overlay.rs b/crates/bevy_ui/src/render/debug_overlay.rs index 6ee7f14732141..662d0d8d0e376 100644 --- a/crates/bevy_ui/src/render/debug_overlay.rs +++ b/crates/bevy_ui/src/render/debug_overlay.rs @@ -76,13 +76,14 @@ pub fn extract_debug_overlay( return; } + let default_camera_entity = default_ui_camera.get(); + for (entity, uinode, visibility, maybe_clip, transform, camera) in &uinode_query { if !debug_options.show_hidden && !visibility.get() { continue; } - let Some(camera_entity) = camera.map(TargetCamera::entity).or(default_ui_camera.get()) - else { + let Some(camera_entity) = camera.map(TargetCamera::entity).or(default_camera_entity) else { continue; }; diff --git a/crates/bevy_ui/src/render/mod.rs b/crates/bevy_ui/src/render/mod.rs index e1528b02d23f0..b69d241dd9b82 100644 --- a/crates/bevy_ui/src/render/mod.rs +++ b/crates/bevy_ui/src/render/mod.rs @@ -267,11 +267,11 @@ pub fn extract_uinode_background_colors( >, mapping: Extract>, ) { + let default_camera_entity = default_ui_camera.get(); for (entity, uinode, transform, view_visibility, clip, camera, background_color) in &uinode_query { - let Some(camera_entity) = camera.map(TargetCamera::entity).or(default_ui_camera.get()) - else { + let Some(camera_entity) = camera.map(TargetCamera::entity).or(default_camera_entity) else { continue; }; @@ -330,9 +330,9 @@ pub fn extract_uinode_images( >, mapping: Extract>, ) { + let default_camera_entity = default_ui_camera.get(); for (entity, uinode, transform, view_visibility, clip, camera, image) in &uinode_query { - let Some(camera_entity) = camera.map(TargetCamera::entity).or(default_ui_camera.get()) - else { + let Some(camera_entity) = camera.map(TargetCamera::entity).or(default_camera_entity) else { continue; }; @@ -423,7 +423,7 @@ pub fn extract_uinode_borders( ui_children: UiChildren, ) { let image = AssetId::::default(); - + let default_camera_entity = default_ui_camera.get(); for ( entity, node, @@ -437,7 +437,7 @@ pub fn extract_uinode_borders( { let Some(camera_entity) = maybe_camera .map(TargetCamera::entity) - .or(default_ui_camera.get()) + .or(default_camera_entity) else { continue; }; diff --git a/crates/bevy_ui/src/render/ui_texture_slice_pipeline.rs b/crates/bevy_ui/src/render/ui_texture_slice_pipeline.rs index f4fc6d77e9a0b..29c10dec09afb 100644 --- a/crates/bevy_ui/src/render/ui_texture_slice_pipeline.rs +++ b/crates/bevy_ui/src/render/ui_texture_slice_pipeline.rs @@ -264,9 +264,10 @@ pub fn extract_ui_texture_slices( >, mapping: Extract>, ) { + let default_camera_entity = default_ui_camera.get(); + for (entity, uinode, transform, view_visibility, clip, camera, image) in &slicers_query { - let Some(camera_entity) = camera.map(TargetCamera::entity).or(default_ui_camera.get()) - else { + let Some(camera_entity) = camera.map(TargetCamera::entity).or(default_camera_entity) else { continue; };