From 46c1480f42a579141717b822d6efbf2c47051e1c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=A0=94=E7=A9=B6=E7=A4=BE=E4=BA=A4?= Date: Mon, 20 Dec 2021 20:33:38 +0000 Subject: [PATCH] Fix hierarchy example panic (#3378) # Objective Fixes #3321 ## Solution Uses `despawn_recursive()` instead of `despawn()` when removing children. --- examples/ecs/hierarchy.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/ecs/hierarchy.rs b/examples/ecs/hierarchy.rs index e3f4e36dd72e5..7de8f8d4b872d 100644 --- a/examples/ecs/hierarchy.rs +++ b/examples/ecs/hierarchy.rs @@ -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 {