Fix hierarchy example panic (#3378)

# Objective
Fixes #3321 

## Solution
Uses `despawn_recursive()` instead of `despawn()` when removing children.
This commit is contained in:
研究社交 2021-12-20 20:33:38 +00:00
parent 340957994d
commit 46c1480f42

View file

@ -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 {