Fix error in DynamicScene (#1651)
The wrong error was returned when using an unregistered type in a scene, leading to a confusing error message.
This commit is contained in:
parent
01bb68b685
commit
de55e05669
@ -72,7 +72,7 @@ impl DynamicScene {
|
|||||||
for component in scene_entity.components.iter() {
|
for component in scene_entity.components.iter() {
|
||||||
let registration = type_registry
|
let registration = type_registry
|
||||||
.get_with_name(component.type_name())
|
.get_with_name(component.type_name())
|
||||||
.ok_or_else(|| SceneSpawnError::UnregisteredComponent {
|
.ok_or_else(|| SceneSpawnError::UnregisteredType {
|
||||||
type_name: component.type_name().to_string(),
|
type_name: component.type_name().to_string(),
|
||||||
})?;
|
})?;
|
||||||
let reflect_component =
|
let reflect_component =
|
||||||
|
|||||||
@ -168,9 +168,15 @@ impl SceneSpawner {
|
|||||||
|
|
||||||
let reflect_component = type_registry
|
let reflect_component = type_registry
|
||||||
.get(component_info.type_id().unwrap())
|
.get(component_info.type_id().unwrap())
|
||||||
.and_then(|registration| registration.data::<ReflectComponent>())
|
.ok_or_else(|| SceneSpawnError::UnregisteredType {
|
||||||
.ok_or_else(|| SceneSpawnError::UnregisteredComponent {
|
|
||||||
type_name: component_info.name().to_string(),
|
type_name: component_info.name().to_string(),
|
||||||
|
})
|
||||||
|
.and_then(|registration| {
|
||||||
|
registration.data::<ReflectComponent>().ok_or_else(|| {
|
||||||
|
SceneSpawnError::UnregisteredComponent {
|
||||||
|
type_name: component_info.name().to_string(),
|
||||||
|
}
|
||||||
|
})
|
||||||
})?;
|
})?;
|
||||||
reflect_component.copy_component(
|
reflect_component.copy_component(
|
||||||
&scene.world,
|
&scene.world,
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user