From dfde160741f1a3a489fa7d52c56fad47c474822c Mon Sep 17 00:00:00 2001 From: Carter Anderson Date: Thu, 25 Jun 2020 13:23:28 -0700 Subject: [PATCH] ecs: add ability to set the current entity in world builders --- crates/bevy_core/src/transform/world_builder.rs | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/crates/bevy_core/src/transform/world_builder.rs b/crates/bevy_core/src/transform/world_builder.rs index 1f4efc6d8c..85a8d31ec2 100644 --- a/crates/bevy_core/src/transform/world_builder.rs +++ b/crates/bevy_core/src/transform/world_builder.rs @@ -34,6 +34,11 @@ impl<'a> WorldBuilder<'a> { self } + pub fn set_entity(&mut self, entity: Entity) -> &mut Self { + self.current_entity = Some(entity); + self + } + /// note: this is slow and does a full entity copy pub fn with(&mut self, component: T) -> &mut Self where @@ -114,6 +119,11 @@ impl<'a> CommandBufferBuilder<'a> { self } + pub fn set_entity(&mut self, entity: Entity) -> &mut Self { + self.current_entity = Some(entity); + self + } + // note: this is slow and does a full entity copy pub fn with(&mut self, component: T) -> &mut Self where