SIGN IN SIGN UP
bevyengine / bevy UNCLAIMED

A refreshingly simple data-driven game engine built in Rust

0 0 86 Rust

`DetectChanges::is_changed_after` (#23149)

# Objective

Make it easier to compare ticks between `Ref`s.  

The pattern used in #23106 to compare changed ticks seems very powerful!
But the second `Tick` parameter in `Tick::is_newer_than` makes it
awkward to use, and requires the developer know about the
`SystemChangeTick` system parameter. Which is silly, because the `Ref`
*already has* those ticks.

## Solution

Introduce `DetectChanges::is_changed_after`,
`DetectChanges::is_added_after`, and `SpawnDetails::is_spawned_after`
methods. These call `Tick::is_newer_than` on the appropriate tick, using
the `last_run` tick that is already stored.

## Showcase

```diff
-        if transform
-            .last_changed()
-            .is_newer_than(previous.last_changed(), system_change_tick.this_run())
-        {
+        if transform.is_changed_after(previous.last_changed()) {
```
C
Chris Russell committed
9c47c7261e0dada2f1f980b6c6afc037b4673ce3
Parent: 7958177
Committed by GitHub <noreply@github.com> on 2/26/2026, 12:06:50 AM