Skip to content

Commit 8f57da9

Browse files
committed
Attempt to remove component from render world if not extracted.
1 parent a06802a commit 8f57da9

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

crates/bevy_render/src/extract_component.rs

+4
Original file line numberDiff line numberDiff line change
@@ -205,6 +205,8 @@ fn extract_components<C: ExtractComponent>(
205205
for (entity, query_item) in &query {
206206
if let Some(component) = C::extract_component(query_item) {
207207
values.push((entity.id(), component));
208+
} else {
209+
commands.entity(entity.id()).remove::<C>();
208210
}
209211
}
210212
*previous_len = values.len();
@@ -222,6 +224,8 @@ fn extract_visible_components<C: ExtractComponent>(
222224
if view_visibility.get() {
223225
if let Some(component) = C::extract_component(query_item) {
224226
values.push((entity.id(), component));
227+
} else {
228+
commands.entity(entity.id()).remove::<C>();
225229
}
226230
}
227231
}

0 commit comments

Comments
 (0)