bevyengine / bevyengine/bevy

Change detection in a system-less context is hard to get working

Open
#5,375 0 comments 1 reaction 0 assignees View on GitHub
A-ECS C-Bug
Dominant language
Rust
Stars
48.2k
Forks
4.8k
Avg merge
3d 22h
Merged PRs (30d)
161

Description

## Bevy version

1ac8a476cf4ad14bd0b9bfb091dd04796652230d

## What you did

```rust
fn raw_resource_change_detection() {
let mut world = World::new();

world.insert_resource(R(0));
world.increment_change_tick();

let mut r = world.resource_mut::();
assert!(!r.is_changed(), "Resource must begin unchanged.");
}
```

## What went wrong

This test fails! To fix it, we must add:

```rust
world.clear_trackers();
```

before we fetch the resource from the `World`.

## Additional information

This was uncovered in #5373; the test there should be updated as part of the PR that fixes this.

Full credit to @maniwani for identifying the workaround.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.