Skip to content

Replace RemovedComponents with observers #13928

@alice-i-cecile

Description

@alice-i-cecile

What problem does this solve or what need does it fill?

RemovedComponents isn't a particularly nice tool: it doesn't fit into our existing tools for responding to changes well, doesn't allow users to read the data as it's being removed, must be continually monitored to avoid missing events, and risks desynchronization because of the polling-based mechanism.

What solution would you like?

Observers (merged in #10839) offer an alternative solution to this problem space without the caveats.

We should deprecate and then remove [RemovedComponents], being careful to update and improve documentation and write a clear migration guide.

In particular, users can emit events, triggered by an observer, to recreate the previous polling-style behavior when it is preferred.

What alternative(s) have you considered?

Other solutions to solve and/or work around the problem presented.

Additional context

#2148 proposes a Removed query filter, which might still be a valuable (if complex) complement even with this PR implemented.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-ECSEntities, components, systems, and eventsC-Code-QualityA section of code that is hard to understand or changeC-UsabilityA targeted quality-of-life change that makes Bevy easier to useD-ComplexQuite challenging from either a design or technical perspective. Ask for help!S-Needs-DesignThis issue requires design work to think about how it would best be accomplishedX-Needs-SMEThis type of work requires an SME to approve it.

    Type

    No type

    Projects

    Status

    No status

    Status

    Needs SME Triage

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions