From 8bfef89e26c880b2c2f5c1c7b81ede90c40fa015 Mon Sep 17 00:00:00 2001 From: HampusM Date: Fri, 2 Aug 2024 16:36:33 +0200 Subject: feat(engine): make Engine::spawn return the spawned entity's UID --- engine/src/lib.rs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/engine/src/lib.rs b/engine/src/lib.rs index bd954be..6d7fa1e 100644 --- a/engine/src/lib.rs +++ b/engine/src/lib.rs @@ -2,6 +2,7 @@ #![allow(clippy::needless_pass_by_value)] use ecs::component::Sequence as ComponentSequence; +use ecs::entity::Uid as EntityUid; use ecs::event::Event; use ecs::extension::Extension; use ecs::sole::Sole; @@ -76,11 +77,11 @@ impl Engine Self { world } } - pub fn spawn(&mut self, components: Comps) + pub fn spawn(&mut self, components: Comps) -> EntityUid where Comps: ComponentSequence, { - self.world.create_entity(components); + self.world.create_entity(components) } pub fn register_system<'this, SystemImpl>( -- cgit v1.2.3-18-g5258