`ReflectMapEntities` on `Children` Component Fails to Complete with Partial `EntityMap`.
- Dominant language
- Rust
- Stars
- 48.2k
- Forks
- 4.8k
- Avg merge
- 3d 22h
- Merged PRs (30d)
- 161
Description
## Bevy version
Tested on Bevy v0.8.1, but the code in question hasn't changed in Bevy 0.9.0.
## What you did
In the `bevy_ggrs` plugin we use the `ReflectMapEntities` data to update all of the `Children` and `Parent` component's stored entity ids whenever we restore a world snapshot.
The issue happens when we try to map entities on `Children` components, but we don't necessarily have every existing entity in the entity map.
The problem is in this line
https://github.com/bevyengine/bevy/blob/e954b8573c085a01c62007c4c6232870e0b5c891/crates/bevy_hierarchy/src/components/children.rs#L26
When we don't have a certain entity in the map, this function returns with an error, but in my scenario, I still need it to map all of the entities that it can, and leave any entities that it can't map the same as what they already were.
For me, patching this so that it only updates the entity if it is in the map, and ignoring it if it isn't fixes my issue. This is similar to what is already done for the Parent component.
I'm not sure if there is a scenario where it's important to report an error or not.
**Edit:** Opened #6791 to fix.
Contributor guide
Assessment
This issue has not been assessed yet.