Skip to content

Commit

Permalink
Attempt to remove component from render world if not extracted.
Browse files Browse the repository at this point in the history
  • Loading branch information
tychedelia committed Oct 14, 2024
1 parent d7b2713 commit 9ec9c7b
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions crates/bevy_render/src/extract_component.rs
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,8 @@ fn extract_components<C: ExtractComponent>(
for (entity, query_item) in &query {
if let Some(component) = C::extract_component(query_item) {
values.push((entity, component));
} else {
commands.entity(entity).remove::<C>();
}
}
*previous_len = values.len();
Expand All @@ -222,6 +224,8 @@ fn extract_visible_components<C: ExtractComponent>(
if view_visibility.get() {
if let Some(component) = C::extract_component(query_item) {
values.push((entity, component));
} else {
commands.entity(entity).remove::<C>();
}
}
}
Expand Down

0 comments on commit 9ec9c7b

Please sign in to comment.