From fb0aa8d286d479c7f5176d124634b637cb88b625 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois?= Date: Mon, 27 Sep 2021 23:32:05 +0000 Subject: [PATCH] enable change detection for hierarchy maintenance (#2411) # Objective Noticed a comment saying changed detection should be enabled for hierarchy maintenance once stable Fixes #891 ## Solution Added `Changed` filter on the query --- .../src/hierarchy/hierarchy_maintenance_system.rs | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/crates/bevy_transform/src/hierarchy/hierarchy_maintenance_system.rs b/crates/bevy_transform/src/hierarchy/hierarchy_maintenance_system.rs index 3f7491f659b56..6fde5d52ebfbb 100644 --- a/crates/bevy_transform/src/hierarchy/hierarchy_maintenance_system.rs +++ b/crates/bevy_transform/src/hierarchy/hierarchy_maintenance_system.rs @@ -1,6 +1,7 @@ use crate::components::*; use bevy_ecs::{ entity::Entity, + prelude::Changed, query::Without, system::{Commands, Query}, }; @@ -10,9 +11,7 @@ use smallvec::SmallVec; pub fn parent_update_system( mut commands: Commands, removed_parent_query: Query<(Entity, &PreviousParent), Without>, - // The next query could be run with a Changed filter. However, this would mean that - // modifications later in the frame are lost. See issue 891: https://github.com/bevyengine/bevy/issues/891 - mut parent_query: Query<(Entity, &Parent, Option<&mut PreviousParent>)>, + mut parent_query: Query<(Entity, &Parent, Option<&mut PreviousParent>), Changed>, mut children_query: Query<&mut Children>, ) { // Entities with a missing `Parent` (ie. ones that have a `PreviousParent`), remove