mirror of
https://github.com/bevyengine/bevy
synced 2024-11-21 12:13:25 +00:00
Fix deactivated camera still being used in render world (#15946)
# Objective Switch to retained render world causes the extracted cameras in render world to not be removed until camera in main world is despawned. When extracting data from main world inactive cameras are skipped. Therefore camera that was active and became inactive has a retained `ExtractedCamera` component from previous frames (when it was active) and is processed the same way as if it were active (there is no `active` field on `ExtractedCamera`). This breakes switching between cameras in `render_primitives` example. Fixes #15822 ## Solution Fix it by removing `ExtractedCamera` and related components from inactive cameras. Note that despawning inactive camera seems to be bad option because they are spawned using `SyncToRenderWorld` component. ## Testing Switching camera in `render_primitives` example now works correctly. --------- Co-authored-by: akimakinai <105044389+akimakinai@users.noreply.github.com>
This commit is contained in:
parent
d15d901cab
commit
fe7f98f7f0
1 changed files with 10 additions and 0 deletions
|
@ -1054,8 +1054,18 @@ pub fn extract_cameras(
|
|||
) in query.iter()
|
||||
{
|
||||
if !camera.is_active {
|
||||
commands.entity(render_entity).remove::<(
|
||||
ExtractedCamera,
|
||||
ExtractedView,
|
||||
RenderVisibleEntities,
|
||||
TemporalJitter,
|
||||
RenderLayers,
|
||||
Projection,
|
||||
GpuCulling,
|
||||
)>();
|
||||
continue;
|
||||
}
|
||||
|
||||
let color_grading = color_grading.unwrap_or(&ColorGrading::default()).clone();
|
||||
|
||||
if let (
|
||||
|
|
Loading…
Reference in a new issue