Skip to content

Instantly share code, notes, and snippets.

@pcwalton
Created February 6, 2024 01:45
Show Gist options
  • Save pcwalton/3d2857a1a169c622fca8891cef88e78e to your computer and use it in GitHub Desktop.
Save pcwalton/3d2857a1a169c622fca8891cef88e78e to your computer and use it in GitHub Desktop.
diff --git a/crates/bevy_transform/src/systems.rs b/crates/bevy_transform/src/systems.rs
index 8f6bac916..53c6d707e 100644
--- a/crates/bevy_transform/src/systems.rs
+++ b/crates/bevy_transform/src/systems.rs
@@ -54,8 +54,13 @@ pub fn propagate_transforms(
mut orphaned: RemovedComponents<Parent>,
transform_query: Query<(Ref<Transform>, &mut GlobalTransform, Option<&Children>), With<Parent>>,
parent_query: Query<(Entity, Ref<Parent>)>,
+ any_changes: Query<Entity, Or<(Changed<Transform>, Changed<Parent>, Changed<Children>)>>,
mut orphaned_entities: Local<Vec<Entity>>,
) {
+ if any_changes.is_empty() {
+ return;
+ }
+
orphaned_entities.clear();
orphaned_entities.extend(orphaned.read());
orphaned_entities.sort_unstable();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment