Compare commits

...

2 Commits

Author SHA1 Message Date
Mark Moissette
d59d34127d
Merge 5daf433b06 into 9b50d77790 2024-08-09 21:10:50 +00:00
Chris Biscardi
5daf433b06
feat(Blenvy:Bevy): improve error message for ReflectComponent data in copy_components(#222) 2024-08-09 23:10:45 +02:00

View File

@ -69,10 +69,15 @@ impl CopyComponents {
}
})
.map(|type_id| {
return (
type_id.data::<ReflectComponent>().unwrap().clone(),
type_id.type_info().type_id(), // we need the original type_id down the line
);
match type_id.data::<ReflectComponent>() {
Some(data) => (
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<_>>()
};