bevy/crates/bevy_ecs/src/entity
Josh Robson Chase 40e88dceff
Change ReflectMapEntities to operate on components before insertion (#15422)
Previous PR https://github.com/bevyengine/bevy/pull/14549 was closed in
error and couldn't be reopened since I had updated the branch
😿

# Objective

Fixes #14465

## Solution

`ReflectMapEntities` now works similarly to `MapEntities` in that it
works on the reflected value itself rather than the component in the
world after insertion. This makes it so that observers see the remapped
entities on insertion rather than the entity IDs from the scene.

`ReflectMapEntities` now works for both components and resources, so we
only need the one.

## Testing

* New unit test for `Observer`s + `DynamicScene`s
* New unit test for `Observer`s + `Scene`s
* Open to suggestions for other tests!

---

## Migration Guide

- Consumers of `ReflectMapEntities` will need to call `map_entities` on
values prior to inserting them into the world.
- Implementors of `MapEntities` will need to remove the `mappings`
method, which is no longer needed for `ReflectMapEntities` and has been
removed from the trait.

---------

Co-authored-by: Alice Cecile <alice.i.cecile@gmail.com>
Co-authored-by: Hennadii Chernyshchyk <genaloner@gmail.com>
2024-10-01 18:34:09 +00:00
..
hash.rs Add core and alloc over std Lints (#15281) 2024-09-27 00:59:59 +00:00
map_entities.rs Change ReflectMapEntities to operate on components before insertion (#15422) 2024-10-01 18:34:09 +00:00
mod.rs Add VisitEntities for generic and reflectable Entity iteration (#15425) 2024-09-30 17:32:03 +00:00
visit_entities.rs Add VisitEntities for generic and reflectable Entity iteration (#15425) 2024-09-30 17:32:03 +00:00