spawn_batch creates incorrect relationships when RelationshipTarget is initially empty #19275
Labels
A-ECS
Entities, components, systems, and events
C-Bug
An unexpected or incorrect behavior
S-Needs-Review
Needs reviewer attention (from anyone!) to move forward
Bevy version
The release number or commit hash of the version you're using: 45ba5b9f0347710d0b84979631fae6f690434d62
What you did
This test is failing:
What went wrong
When using
World::spawn_batch
with an initially emptyRelationshipTarget
, relationships between entities are not established.World::spawn
in a loop.World::spawn_batch
to spawn multiple entities referencing the same target entity, and that target has noRelationshipTarget
, each subsequent command overwrites theRelationshipTarget
created by the previous one. This happens becauseWorld::spawn_batch
defers commands execution, and hooks that update theRelationshipTarget
run before previous commands are flushed. As a result, every iteration sees an emptyRelationshipTarget
on the target and reinitializes it.Additional information
spawn_batch
spawn_batch
for the rest within the same target groupThe text was updated successfully, but these errors were encountered: