#ecs #tree #bevy #gamedev #despawn

bevy_despawn_tree

Despawn an entire parent-child entity hierarchy from any entity at any depth in the hierarchy

1 unstable release

0.1.0 Oct 13, 2022

#314 in #ecs

MIT/Apache

16KB
63 lines

bevy_despawn_tree

crates.io MIT/Apache 2.0 crates.io

An extension method for Bevy's EntityCommands that despawns an entire parent-child entity hierarchy tree from an EntityCommands for any entity at any depth in the hierarchy.

Supports Bevy 0.8

Usage

Add the dependency to your project's Cargo.toml:

bevy_despawn_tree = "0.1.0"

Then to despawn the tree containing the entity leaf:

use bevy_despawn_tree::*;

commands.entity(leaf).despawn_tree();

Example

Spawns two marked trees, despawns one from a queried child without touching the other.

cargo run --example example

Dependencies

~18–33MB
~550K SLoC