Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
`parent_update` and `transform_propagate` run in the same stage but `parent_update` can spawn `Children`. This means that the `system` can enter an inconsistent state where the `GlobalTransform` has not been updated on `Children` when spawning an `Entity` where the `Parent` does not have an existing `Children` component.

Introduce a marker trait, `DirtyParent`, so that the system will revert to the correct state the next time the systems run.
  • Loading branch information
yilinwei authored and DJMcNab committed Apr 26, 2022
1 parent 45d2c78 commit 0977aba
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions crates/bevy_hierarchy/src/components/parent.rs
Original file line number Diff line number Diff line change
Expand Up @@ -62,3 +62,6 @@ impl FromWorld for PreviousParent {
PreviousParent(Entity::from_raw(u32::MAX))
}
}

#[derive(Component, Debug, Copy, Clone, Eq, PartialEq, Reflect)]
pub struct DirtyParent;

0 comments on commit 0977aba

Please sign in to comment.