Skip to content

Bevy Commands extension trait for despawning multiple marked entities at once.

License

MIT, Unknown licenses found

Licenses found

MIT
LICENSE
Unknown
LICENSE-APACHE
Notifications You must be signed in to change notification settings

ickshonpe/bevy_despawn_with

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

28 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Bevy Despawn With

crates.io MIT/Apache 2.0 crates.io

This crate implements an extension trait on Commands, DespawnAllCommandsExt which has two methods despawn_all and despawn_all_recursive for despawning multiple entities:

fn despawn_system(
    mut commands: Commands,
) {
    commands.despawn_all::<(With<People>, With<Shoes>, Without<Laces>)>();
}

Usage

Add the dependency to your project's Cargo.toml [dependencies] section:

bevy_despawn_with = "0.15.0"

Then despawn some things:

use bevy_despawn_with::DespawnAllCommandsExt;

fn despawn_system(mut commands: Commands) {
    // Despawn all entities with a MenuUiMarker component
    commands.despawn_all::<With<MenuUiMarker>>();

    // Despawn all entities without a SomeOtherMarker component, 
    // and despawn those entities descendants.
    commands.despawn_all_recursive::<Without<SomeOtherMarker>>();

    // Despawn all entities with a MenuUiMarker component, or with a changed GlobalTransform.
    commands.despawn_all::<Or<(With<MenUiMarker>, Changed<GlobalTransform>)>>();
}

Examples

cargo run --example despawn_with
cargo run --example despawn_without

Notes

Supports Bevy 0.10

About

Bevy Commands extension trait for despawning multiple marked entities at once.

Topics

Resources

License

MIT, Unknown licenses found

Licenses found

MIT
LICENSE
Unknown
LICENSE-APACHE

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages