ReflectMapEntities
on Children
Component Fails to Complete with Partial EntityMap
.
#6790
Labels
A-ECS
Entities, components, systems, and events
A-Hierarchy
Parent-child entity hierarchies
A-Reflection
Runtime information about types
C-Bug
An unexpected or incorrect behavior
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 theReflectMapEntities
data to update all of theChildren
andParent
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
bevy/crates/bevy_hierarchy/src/components/children.rs
Line 26 in e954b85
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.
The text was updated successfully, but these errors were encountered: