bevy/examples/ecs
Aceeri 67826b21d4 Replace RemovedComponents<T> backing with Events<Entity> (#5680)
# Objective
Removal events are unwieldy and require some knowledge of when to put systems that need to catch events for them, it is very easy to end up missing one and end up with memory leak-ish issues where you don't clean up after yourself.

## Solution
Consolidate removals with the benefits of `Events<...>` (such as double buffering and per system ticks for reading the events) and reduce the special casing of it, ideally I was hoping to move the removals to a `Resource` in the world, but that seems a bit more rough to implement/maintain because of double mutable borrowing issues.

This doesn't go the full length of change detection esque removal detection a la https://github.com/bevyengine/rfcs/pull/44.
Just tries to make the current workflow a bit more user friendly so detecting removals isn't such a scheduling nightmare.

---

## Changelog
- RemovedComponents<T> is now backed by an `Events<Entity>` for the benefits of double buffering.

## Migration Guide
- Add a `mut` for `removed: RemovedComponents<T>` since we are now modifying an event reader internally.
- Iterating over removed components now requires `&mut removed_components` or `removed_components.iter()` instead of `&removed_components`.
2023-02-04 20:53:37 +00:00
..
component_change_detection.rs Fix minor typos in code and docs (#7378) 2023-01-27 12:12:53 +00:00
custom_query_param.rs fix nightly clippy warnings (#6395) 2022-10-28 21:03:01 +00:00
ecs_guide.rs fix nightly clippy warnings (#6395) 2022-10-28 21:03:01 +00:00
event.rs Replace the bool argument of Timer with TimerMode (#6247) 2022-10-17 13:47:01 +00:00
fixed_timestep.rs Add global time scaling (#5752) 2022-10-22 18:52:29 +00:00
generic_system.rs Replace the bool argument of Timer with TimerMode (#6247) 2022-10-17 13:47:01 +00:00
hierarchy.rs Add global time scaling (#5752) 2022-10-22 18:52:29 +00:00
iter_combinations.rs use Mul<f32> to double the value of Vec3 (#6607) 2022-11-14 23:08:30 +00:00
nondeterministic_system_order.rs Reduce internal system order ambiguities, and add an example explaining them (#7383) 2023-01-31 01:47:00 +00:00
parallel_query.rs Basic adaptive batching for parallel query iteration (#4777) 2023-01-20 08:47:20 +00:00
removal_detection.rs Replace RemovedComponents<T> backing with Events<Entity> (#5680) 2023-02-04 20:53:37 +00:00
startup_system.rs Doc/module style doc blocks for examples (#4438) 2022-05-16 13:53:20 +00:00
state.rs Remove auto-margin properties from the examples (#6535) 2022-11-21 14:38:35 +00:00
system_closure.rs fix nightly clippy warnings (#6395) 2022-10-28 21:03:01 +00:00
system_param.rs Spawn now takes a Bundle (#6054) 2022-09-23 19:55:54 +00:00
system_piping.rs [Fixes #6224] Add logging variants of system piping (#6751) 2022-12-11 18:10:03 +00:00
system_sets.rs Fix minor typos in code and docs (#7378) 2023-01-27 12:12:53 +00:00
timers.rs Replace the bool argument of Timer with TimerMode (#6247) 2022-10-17 13:47:01 +00:00