feat(Blenvy:Bevy): improve error message for ReflectComponent data in copy_components(#222)

This commit is contained in:
Chris Biscardi 2024-08-09 14:10:45 -07:00 committed by GitHub
parent 33f2809682
commit 5daf433b06
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 9 additions and 4 deletions

View File

@ -69,10 +69,15 @@ impl CopyComponents {
} }
}) })
.map(|type_id| { .map(|type_id| {
return ( match type_id.data::<ReflectComponent>() {
type_id.data::<ReflectComponent>().unwrap().clone(), Some(data) => (
type_id.type_info().type_id(), // we need the original type_id down the line data.clone(),
); type_id.type_info().type_id(), // we need the original type_id down the line
),
None => {
panic!("type {:?}'s ReflectComponent data was not found in the type registry, this could be because the type is missing a #[reflect(Component)]", type_id.type_info().type_path());
}
}
}) })
.collect::<Vec<_>>() .collect::<Vec<_>>()
}; };