summaryrefslogtreecommitdiff
path: root/engine-ecs
diff options
context:
space:
mode:
Diffstat (limited to 'engine-ecs')
-rw-r--r--engine-ecs/src/component.rs12
1 files changed, 12 insertions, 0 deletions
diff --git a/engine-ecs/src/component.rs b/engine-ecs/src/component.rs
index cbd45e7..847ecbd 100644
--- a/engine-ecs/src/component.rs
+++ b/engine-ecs/src/component.rs
@@ -303,6 +303,18 @@ pub struct Parts
impl Parts
{
+ pub fn from_component_info(component_info: &Info, id: Uid, data: Box<dyn Any>)
+ -> Self
+ {
+ assert_eq!((*data).type_id(), component_info.ty_id);
+
+ Self::builder()
+ .type_reflection(component_info.type_reflection)
+ .name(component_info.name)
+ .is_sole(component_info.is_sole)
+ .build_with_any_data(id, data)
+ }
+
#[must_use]
pub fn builder() -> PartsBuilder
{