rfcs
rfcs copied to clipboard
Removed query filter
Addresses https://github.com/bevyengine/bevy/issues/2148 by proposing a Removed<C>
query filter.
This works exactly as you might hope, using reliable change detection semantics and mechanisms. Full credit to @maniwani (Joy) for the core idea of just storing another component with the change tick.
Some notes:
- We can't fully remove
RemovedComponents
, since this doesn't work for despawned entities, since they no longer exist to be queried for. - The current design is opt-in, using the machinery from #27, to avoid pointless performance overhead.
It was actually written with derive(Component)
in mind, but yes, this is a little stale. Let me take a look :)
One more question this RFC should address is, "What happens to LastRemoved<T>
if you insert T
again?"
Also, I'm thinking there should be a way to rig this internally so that the options are:
- no removal detection
- ticks only
- ticks + data
Also if the strategy stays as described, I think "no removal detection" should be default if you can't auto-detect it from queries, since LastRemoved<T>
being a component will fragment archetypes.