diff --git a/crates/bevy_ui/src/update.rs b/crates/bevy_ui/src/update.rs index bb8752797b..88511453ce 100644 --- a/crates/bevy_ui/src/update.rs +++ b/crates/bevy_ui/src/update.rs @@ -9,10 +9,10 @@ use crate::{ use super::ComputedNode; use bevy_ecs::{ change_detection::DetectChangesMut, - entity::{Entity, EntityHashSet}, + entity::Entity, hierarchy::ChildOf, query::{Changed, With}, - system::{Commands, Local, Query, Res}, + system::{Commands, Query, Res}, }; use bevy_math::{Rect, UVec2}; use bevy_render::camera::Camera; @@ -139,9 +139,7 @@ pub fn update_ui_context_system( mut computed_target_query: Query<&mut ComputedNodeTarget>, ui_children: UiChildren, reparented_nodes: Query<(Entity, &ChildOf), (Changed, With)>, - mut visited: Local, ) { - visited.clear(); let default_camera_entity = default_ui_camera.get(); for root_entity in ui_root_nodes.iter() { @@ -172,7 +170,6 @@ pub fn update_ui_context_system( }, &ui_children, &mut computed_target_query, - &mut visited, ); } @@ -186,7 +183,6 @@ pub fn update_ui_context_system( *computed_target, &ui_children, &mut computed_target_query, - &mut visited, ); } } @@ -196,24 +192,14 @@ fn update_contexts_recursively( inherited_computed_target: ComputedNodeTarget, ui_children: &UiChildren, query: &mut Query<&mut ComputedNodeTarget>, - visited: &mut EntityHashSet, ) { - if !visited.insert(entity) { - return; - } if query .get_mut(entity) .map(|mut computed_target| computed_target.set_if_neq(inherited_computed_target)) .unwrap_or(false) { for child in ui_children.iter_ui_children(entity) { - update_contexts_recursively( - child, - inherited_computed_target, - ui_children, - query, - visited, - ); + update_contexts_recursively(child, inherited_computed_target, ui_children, query); } } }