Skip to content

HierarchyPropagatePlugin fails on #24549

@ickshonpe

Description

@ickshonpe

Bevy version and features

main 9a35b6a

What you did

Added this test to the propagate module, it fails.

    #[test]
    fn test_remove_and_reinsert_propagate() {
        let mut app = App::new();
        app.add_schedule(Schedule::new(Update));
        app.add_plugins(HierarchyPropagatePlugin::<TestValue>::new(Update));

        let parent = app.world_mut().spawn(Propagate(TestValue(1))).id();

        let child = app.world_mut().spawn_empty().insert(ChildOf(parent)).id();

        app.update();

        app.world_mut()
            .entity_mut(parent)
            .remove::<Propagate<TestValue>>()
            .insert(Propagate(TestValue(1)));
        app.update();

        assert_eq!(
            app.world_mut()
                .query::<&TestValue>()
                .get_many(app.world(), [parent, child]),
            Ok([&TestValue(1), &TestValue(1)])
        );
    }

Also see #24546

What went wrong

If Propagate is removed and then immediately reinserted, the propagated components are removed.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-AppBevy apps and pluginsC-BugAn unexpected or incorrect behaviorS-Ready-For-ImplementationThis issue is ready for an implementation PR. Go for it!

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions