diff options
| author | HampusM <hampus@hampusmat.com> | 2026-07-21 16:17:12 +0200 |
|---|---|---|
| committer | HampusM <hampus@hampusmat.com> | 2026-07-21 16:17:12 +0200 |
| commit | f8e9fc157a205451607ddff6975027b3573c3934 (patch) | |
| tree | e0ce8e96576ce719a06a41ac90ee69aeda37c9b1 /engine-ecs/src/entity.rs | |
| parent | 763b01fd3f35842d1bc065ad27e5a6a6d4265cef (diff) | |
feat(engine-ecs): automatically include entity name component in declared entities
Diffstat (limited to 'engine-ecs/src/entity.rs')
| -rw-r--r-- | engine-ecs/src/entity.rs | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/engine-ecs/src/entity.rs b/engine-ecs/src/entity.rs index 4e0ca52..ba85956 100644 --- a/engine-ecs/src/entity.rs +++ b/engine-ecs/src/entity.rs @@ -322,7 +322,14 @@ macro_rules! declare_entity { $(#[$attr])* $visibility static $ident: $crate::entity::Declaration = $crate::entity::Declaration::new(|world| { - world.spawn_with_uid(*$ident, $components); + use $crate::tuple::Tuple; + + world.spawn_with_uid( + *$ident, + ($components).with_elem($crate::entity::Name { + name: concat!(module_path!(), stringify!($ident)).into() + }) + ); }); )+ } |
