diff options
Diffstat (limited to 'engine-ecs')
| -rw-r--r-- | engine-ecs/src/component.rs | 2 | ||||
| -rw-r--r-- | engine-ecs/src/lib.rs | 20 |
2 files changed, 10 insertions, 12 deletions
diff --git a/engine-ecs/src/component.rs b/engine-ecs/src/component.rs index aee4904..30869b5 100644 --- a/engine-ecs/src/component.rs +++ b/engine-ecs/src/component.rs @@ -370,7 +370,7 @@ impl Default for PartsBuilder #[non_exhaustive] pub struct Info { - pub type_reflection: &'static crate::reflection::Type, + pub type_reflection: Option<&'static crate::reflection::Type>, pub ty_id: TypeId, pub name: &'static str, } diff --git a/engine-ecs/src/lib.rs b/engine-ecs/src/lib.rs index b682906..62d2f71 100644 --- a/engine-ecs/src/lib.rs +++ b/engine-ecs/src/lib.rs @@ -629,15 +629,13 @@ impl World continue; } - if let Some(type_reflection) = component_parts.type_reflection { - Self::create_component_info_entity( - comp_id, - comp_name, - type_reflection, - comp_type_id, - component_storage, - ); - } + Self::create_component_info_entity_if_missing( + comp_id, + comp_name, + component_parts.type_reflection, + comp_type_id, + component_storage, + ); event_submitter.submit_event( &Pair::builder() @@ -649,10 +647,10 @@ impl World } } - fn create_component_info_entity( + fn create_component_info_entity_if_missing( comp_id: Uid, comp_name: &'static str, - type_reflection: &'static TypeReflection, + type_reflection: Option<&'static TypeReflection>, type_id: TypeId, component_storage: &mut ComponentStorage, ) |
