bevyengine / bevyengine/bevy

Entity Markers

Open
#6,556 20 comments 0 reactions 0 assignees View on GitHub
A-ECS C-Usability X-Needs-SME
Dominant language
Rust
Stars
48.2k
Forks
4.8k
Avg merge
3d 22h
Merged PRs (30d)
161

Description

## What problem does this solve or what need does it fill?

A Marker trait that can mark an entity. example

```rust
#[derive(Marker)]
pub enum Players {
Red,
Blue,
Green,
}
```

then we can assign an entity with a marker
```rust
commands.spawn(PlayerBundle::default()).mark(Players::Red);
```

and we can easily query players
```rust
fn add_items_to_red_and_blue(red_query: Query>, MarkedAs>>) {
// ...
}
```

## What solution would you like?

An Marker that works like a Resource but holds a EntityID and the Marker can be used in Queries.

## What alternative(s) have you considered?

Manually make Resources holding EntityIDs and then using a normal query and using .get with the entityID from the resource.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.