Skip to content

Commit

Permalink
Fix Alien Cake Addict example despawn warnings (#7236)
Browse files Browse the repository at this point in the history
# Problem
The example's `teardown` system despawns all entities besides the camera using `despawn_recursive` causing it to despawn child entities multiple times which logs a warning.
![image](https://user-images.githubusercontent.com/29694403/212756554-06b3fa42-ddcb-4a05-b841-f587488a10fc.png)

# Solution
Use `despawn` instead.

Co-authored-by: Devil Ira <[email protected]>
  • Loading branch information
tim-blackbird and tim-blackbird committed Jan 16, 2023
1 parent 2f4cf76 commit 5fd628e
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion examples/games/alien_cake_addict.rs
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ fn setup(mut commands: Commands, asset_server: Res<AssetServer>, mut game: ResMu
// remove all entities that are not a camera
fn teardown(mut commands: Commands, entities: Query<Entity, Without<Camera>>) {
for entity in &entities {
commands.entity(entity).despawn_recursive();
commands.entity(entity).despawn();
}
}

Expand Down

0 comments on commit 5fd628e

Please sign in to comment.