bevyengine / bevyengine/bevy

Add a Removed query filter

Open
#2,148 10 comments 21 reactions 0 assignees View on GitHub
A-ECS C-Feature C-Usability D-Complex S-Needs-Design-Doc
Dominant language
Rust
Stars
48.2k
Forks
4.8k
Avg merge
4d 8m
Merged PRs (30d)
147

Description

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

The existing RemovedComponent API is somewhat unclear and cumbersome. It also commonly requires a manual query filtering step to make use of, which is both slow and full of boilerplate.

## What solution would you like?

I want to be able to add `Removed` to my queries as a filter to only include entities that have had the component removed since the system last ran using reliable change detection.

## What alternative(s) have you considered?

We could also store the values of the removed components, but that won't be feasible with reliable change detection.

## Additional context

With the addition of subworlds / multiple worlds (https://github.com/bevyengine/rfcs/pull/16), we could move removed components to a parallel purgatory subworld for two frames using a double-buffer pattern, allowing us the ability to access removed data.

https://github.com/bevyengine/bevy/issues/13928 offers another way to remove `RemovedComponents`, which should be pursued. It may still be worth having a `Removed` filter after that, but its value is much less clear.

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.