Skip to content

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

@alice-i-cecile

Description

@alice-i-cecile

Bevy version

1ac8a47

What you did

    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::<R>();
        assert!(!r.is_changed(), "Resource must begin unchanged.");
   }

What went wrong

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

        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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-ECSEntities, components, systems, and eventsC-BugAn unexpected or incorrect behavior

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions