diff --git a/crates/bevy_ecs/src/change_detection.rs b/crates/bevy_ecs/src/change_detection.rs index 3802af55dd349..01921f5dcba0c 100644 --- a/crates/bevy_ecs/src/change_detection.rs +++ b/crates/bevy_ecs/src/change_detection.rs @@ -49,7 +49,7 @@ pub trait DetectChanges { /// Returns `true` if this value was added or mutably dereferenced after the system last ran. fn is_changed(&self) -> bool; - /// Returns the change tick recording the previous time this data was changed. + /// Returns the change tick recording the time this data was most recently changed. /// /// Note that components and resources are also marked as changed upon insertion. /// @@ -103,7 +103,7 @@ pub trait DetectChangesMut: DetectChanges { /// **Note**: This operation cannot be undone. fn set_changed(&mut self); - /// Manually sets the change tick recording the previous time this data was mutated. + /// Manually sets the change tick recording the time when this data was last mutated. /// /// # Warning /// This is a complex and error-prone operation, primarily intended for use with rollback networking strategies. @@ -150,7 +150,7 @@ macro_rules! change_detection_impl { #[inline] fn last_changed(&self) -> u32 { - self.ticks.last_change_tick + self.ticks.changed.tick } } @@ -186,7 +186,9 @@ macro_rules! change_detection_mut_impl { #[inline] fn set_last_changed(&mut self, last_change_tick: u32) { - self.ticks.last_change_tick = last_change_tick + self.ticks + .changed + .set_changed(last_change_tick); } #[inline]