Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/ickshonpe/bevy_despawn_with
Bevy Commands extension trait for despawning multiple marked entities at once.
https://github.com/ickshonpe/bevy_despawn_with
bevy rust
Last synced: about 2 months ago
JSON representation
Bevy Commands extension trait for despawning multiple marked entities at once.
- Host: GitHub
- URL: https://github.com/ickshonpe/bevy_despawn_with
- Owner: ickshonpe
- License: mit
- Created: 2022-02-26T09:40:10.000Z (almost 3 years ago)
- Default Branch: main
- Last Pushed: 2023-03-08T16:34:22.000Z (almost 2 years ago)
- Last Synced: 2024-04-29T09:21:20.158Z (8 months ago)
- Topics: bevy, rust
- Language: Rust
- Homepage:
- Size: 51.8 KB
- Stars: 6
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Bevy Despawn With
[![crates.io](https://img.shields.io/crates/v/bevy_despawn_with)](https://crates.io/crates/bevy_despawn_with)
[![MIT/Apache 2.0](https://img.shields.io/badge/license-MIT%2FApache-blue.svg)](https://github.com/ickshonpe/bevy_despawn_with)
[![crates.io](https://img.shields.io/crates/d/bevy_despawn_with)](https://crates.io/crates/bevy_despawn_with)This crate implements an extension trait on `Commands`, `DespawnAllCommandsExt` which has two methods `despawn_all` and `despawn_all_recursive` for despawning multiple entities:
```rust
fn despawn_system(
mut commands: Commands,
) {
commands.despawn_all::<(With, With, Without)>();
}
```## Usage
Add the dependency to your project's Cargo.toml `[dependencies]` section:
```toml
bevy_despawn_with = "0.15.0"
```Then despawn some things:
```rust
use bevy_despawn_with::DespawnAllCommandsExt;fn despawn_system(mut commands: Commands) {
// Despawn all entities with a MenuUiMarker component
commands.despawn_all::>();// Despawn all entities without a SomeOtherMarker component,
// and despawn those entities descendants.
commands.despawn_all_recursive::>();// Despawn all entities with a MenuUiMarker component, or with a changed GlobalTransform.
commands.despawn_all::, Changed)>>();
}
```## Examples
```
cargo run --example despawn_with
cargo run --example despawn_without
```## Notes
Supports Bevy 0.10