diff --git a/crates/bevy_pbr/src/render/light.rs b/crates/bevy_pbr/src/render/light.rs index 57ed8f2686..fe14688a24 100644 --- a/crates/bevy_pbr/src/render/light.rs +++ b/crates/bevy_pbr/src/render/light.rs @@ -31,7 +31,7 @@ use bevy_render::{ }; use bevy_render::{ mesh::allocator::SlabId, - sync_world::{MainEntity, RenderEntity, TemporaryRenderEntity}, + sync_world::{MainEntity, RenderEntity}, }; use bevy_transform::{components::GlobalTransform, prelude::Transform}; #[cfg(feature = "trace")] @@ -286,7 +286,7 @@ pub fn extract_lights( let render_cubemap_visible_entities = RenderCubemapVisibleEntities { data: cubemap_visible_entities .iter() - .map(|v| create_render_visible_mesh_entities(&mut commands, &mapper, v)) + .map(|v| create_render_visible_mesh_entities(&mapper, v)) .collect::>() .try_into() .unwrap(), @@ -343,7 +343,7 @@ pub fn extract_lights( continue; } let render_visible_entities = - create_render_visible_mesh_entities(&mut commands, &mapper, visible_entities); + create_render_visible_mesh_entities(&mapper, visible_entities); let texel_size = 2.0 * ops::tan(spot_light.outer_angle) / directional_light_shadow_map.size as f32; @@ -430,7 +430,7 @@ pub fn extract_lights( cascade_visible_entities.insert( entity, v.iter() - .map(|v| create_render_visible_mesh_entities(&mut commands, &mapper, v)) + .map(|v| create_render_visible_mesh_entities(&mapper, v)) .collect(), ); } else { @@ -469,7 +469,6 @@ pub fn extract_lights( } fn create_render_visible_mesh_entities( - commands: &mut Commands, mapper: &Extract>, visible_entities: &VisibleMeshEntities, ) -> RenderVisibleMeshEntities { @@ -477,9 +476,7 @@ fn create_render_visible_mesh_entities( entities: visible_entities .iter() .map(|e| { - let render_entity = mapper - .get(*e) - .unwrap_or_else(|_| commands.spawn(TemporaryRenderEntity).id()); + let render_entity = mapper.get(*e).unwrap_or(Entity::PLACEHOLDER); (render_entity, MainEntity::from(*e)) }) .collect(), diff --git a/crates/bevy_render/src/camera/camera.rs b/crates/bevy_render/src/camera/camera.rs index f0603157fb..1221c66a79 100644 --- a/crates/bevy_render/src/camera/camera.rs +++ b/crates/bevy_render/src/camera/camera.rs @@ -6,7 +6,7 @@ use crate::{ render_asset::RenderAssets, render_graph::{InternedRenderSubGraph, RenderSubGraph}, render_resource::TextureView, - sync_world::{RenderEntity, SyncToRenderWorld, TemporaryRenderEntity}, + sync_world::{RenderEntity, SyncToRenderWorld}, texture::GpuImage, view::{ ColorGrading, ExtractedView, ExtractedWindows, GpuCulling, Msaa, RenderLayers, @@ -1098,9 +1098,7 @@ pub fn extract_cameras( .get(*entity) .cloned() .map(|entity| entity.id()) - .unwrap_or_else(|_e| { - commands.spawn(TemporaryRenderEntity).id() - }); + .unwrap_or(Entity::PLACEHOLDER); (render_entity, (*entity).into()) }) .collect();