From 72079cf8e0dd54d3cbf5b4c5ed359cbb18b7b847 Mon Sep 17 00:00:00 2001 From: UkoeHB <37489173+UkoeHB@users.noreply.github.com> Date: Fri, 13 Dec 2024 12:55:22 -0600 Subject: [PATCH] Reorder PickSet::Focus systems (#16791) # Objective - `PointerInteraction` components should be updated before sending picking events. Otherwise they will be stale when event observers run. - Allow inserting logic before picking events but after `PointerInteraction` components have been updated. ## Solution - Reorder systems in `PickSet::Focus`. --- crates/bevy_picking/src/focus.rs | 2 +- crates/bevy_picking/src/lib.rs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/crates/bevy_picking/src/focus.rs b/crates/bevy_picking/src/focus.rs index 8c3246d96ea9a..e730e41ce7d45 100644 --- a/crates/bevy_picking/src/focus.rs +++ b/crates/bevy_picking/src/focus.rs @@ -200,7 +200,7 @@ pub enum PickingInteraction { None = 0, } -/// Uses pointer events to update [`PointerInteraction`] and [`PickingInteraction`] components. +/// Uses [`HoverMap`] changes to update [`PointerInteraction`] and [`PickingInteraction`] components. pub fn update_interactions( // Input hover_map: Res, diff --git a/crates/bevy_picking/src/lib.rs b/crates/bevy_picking/src/lib.rs index 9a04220ba26cf..ed77e98926c25 100644 --- a/crates/bevy_picking/src/lib.rs +++ b/crates/bevy_picking/src/lib.rs @@ -414,7 +414,7 @@ impl Plugin for InteractionPlugin { .add_event::>() .add_systems( PreUpdate, - (update_focus, pointer_events, update_interactions) + (update_focus, update_interactions, pointer_events) .chain() .in_set(PickSet::Focus), );