Skip to content

Commit

Permalink
Fix hierarchy example panic (#3378)
Browse files Browse the repository at this point in the history
# Objective
Fixes #3321 

## Solution
Uses `despawn_recursive()` instead of `despawn()` when removing children.
  • Loading branch information
cryscan committed Dec 20, 2021
1 parent 3409579 commit 46c1480
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion examples/ecs/hierarchy.rs
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ fn rotate(
// seconds
if time.seconds_since_startup() >= 2.0 && children.len() == 3 {
let child = children.last().copied().unwrap();
commands.entity(child).despawn();
commands.entity(child).despawn_recursive();
}

if time.seconds_since_startup() >= 4.0 {
Expand Down

0 comments on commit 46c1480

Please sign in to comment.