bevy/crates/bevy_ecs/src
Chris Juchem fefe5297ad Fix DetectChanges::last_changed returning the wrong tick (#7560)
# Objective

Make `last_changed` behave as described in its docs.

## Solution

- Return `changed` instead of `last_change_tick`. `last_change_tick` is the system's previous tick and is just used for comparison.
- Update the docs of the similarly named `set_last_changed` (which does correctly interact with `last_change_tick`) to clarify that the two functions touch different data. (I advocate for renaming one or the other if anyone has any good suggestions).

It also might make sense to return a cloned `Tick` instead of `u32`.

---

## Changelog

- Fixed `DetectChanges::last_changed` returning the wrong value.
- Fixed `DetectChangesMut::set_last_changed` not actually updating the `changed` tick. 

## Migration Guide

- The incorrect value that was being returned by `DetectChanges::last_changed` was the previous run tick of the system checking for changed values. If you depended on this value, you can get it from the `SystemChangeTick` `SystemParam` instead.
2023-02-09 17:07:15 +00:00
..
entity Make EntityRef::new unsafe (#7222) 2023-01-16 22:10:51 +00:00
query Rename Tick::is_older_than to Tick::is_newer_than (#7561) 2023-02-09 16:21:22 +00:00
schedule Add condition negation (#7559) 2023-02-08 23:24:36 +00:00
storage Add World::clear_resources & World::clear_all (#3212) 2023-01-17 04:20:42 +00:00
system Allow piping run conditions (#7547) 2023-02-07 22:22:16 +00:00
world Move all logic to UnsafeWorldCell (#7381) 2023-02-06 19:02:52 +00:00
archetype.rs Fix minor typos in code and docs (#7378) 2023-01-27 12:12:53 +00:00
bundle.rs Fix beta clippy lints (#7154) 2023-01-11 09:51:22 +00:00
change_detection.rs Fix DetectChanges::last_changed returning the wrong tick (#7560) 2023-02-09 17:07:15 +00:00
component.rs Rename Tick::is_older_than to Tick::is_newer_than (#7561) 2023-02-09 16:21:22 +00:00
event.rs Simplify a doc example for EventWriter (#7549) 2023-02-07 16:45:26 +00:00
lib.rs Add a SystemParam primitive for deferred mutations; allow #[derive]ing more types of SystemParam (#6817) 2023-02-06 21:57:57 +00:00
reflect.rs bevy_ecs: ReflectComponentFns without World (#7206) 2023-02-03 05:53:58 +00:00
removal_detection.rs Add a wrapper around Entity for RemovedComponents (#7503) 2023-02-05 15:37:07 +00:00