diff options
| author | HampusM <hampus@hampusmat.com> | 2026-07-09 01:54:02 +0200 |
|---|---|---|
| committer | HampusM <hampus@hampusmat.com> | 2026-07-09 01:54:02 +0200 |
| commit | f193d6222ba7572be733d53630f22191c0506c80 (patch) | |
| tree | 467d265e2f5c048960a00099131bf0f1f8d32604 /engine-ecs/src | |
| parent | eecf733d513a688ffcc4d9280e8965a7c2b6c49a (diff) | |
feat(engine-ecs): create component info entity for components without type reflection
Diffstat (limited to 'engine-ecs/src')
| -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, ) |
