This commit is contained in:
JMS55 2023-12-07 20:35:49 -08:00
parent 3c0057d961
commit d3f5a985ba

View file

@ -64,7 +64,9 @@ pub fn apply_mutations(
value value
.as_any() .as_any()
.downcast_ref::<Arc<dyn Reflect>>() .downcast_ref::<Arc<dyn Reflect>>()
.expect("Attribute value does not impl Reflect"), .expect(&format!(
"Encountered an attribute with name {name} that did not impl Reflect"
)),
)), )),
BorrowedAttributeValue::None => None, BorrowedAttributeValue::None => None,
_ => unreachable!("Should not be used by bevy_dioxus elements"), _ => unreachable!("Should not be used by bevy_dioxus elements"),
@ -96,7 +98,7 @@ impl Command for SetReflectedComponent {
let reflected_component = type_registry let reflected_component = type_registry
.get_with_type_path(&self.component_type_path) .get_with_type_path(&self.component_type_path)
.expect(&format!( .expect(&format!(
"Encountered an attribute with name {} that was not registered", "Encountered an attribute with name {} that was not registered for reflection",
self.component_type_path self.component_type_path
)) ))
.data::<ReflectComponent>() .data::<ReflectComponent>()
@ -107,7 +109,7 @@ impl Command for SetReflectedComponent {
let entity_mut = &mut world.entity_mut(self.entity); let entity_mut = &mut world.entity_mut(self.entity);
match self.component_value { match self.component_value {
Some(value) => reflected_component.apply_or_insert(entity_mut, &*value), Some(value) => reflected_component.insert(entity_mut, &*value),
None => reflected_component.remove(entity_mut), None => reflected_component.remove(entity_mut),
} }
}); });