diff --git a/examples/reflection/reflection.rs b/examples/reflection/reflection.rs index 2446f7704cc492..73e8fc37a8e7ba 100644 --- a/examples/reflection/reflection.rs +++ b/examples/reflection/reflection.rs @@ -2,7 +2,7 @@ use bevy::{ prelude::*, reflect::{ serde::{ReflectDeserializer, ReflectSerializer}, - DynamicStruct, FromReflect, TypeRegistry, + DynamicStruct, TypeRegistry, }, }; use serde::de::DeserializeSeed; @@ -21,8 +21,8 @@ fn main() { /// Deriving `Reflect` implements the relevant reflection traits. In this case, it implements the /// `Reflect` trait and the `Struct` trait `derive(Reflect)` assumes that all fields also implement -/// Reflect, except the ignored fields which should implement `Default`. -#[derive(Reflect, FromReflect)] +/// Reflect. +#[derive(Reflect)] pub struct Foo { a: usize, nested: Bar, @@ -32,12 +32,11 @@ pub struct Foo { /// This `Bar` type is used in the `nested` field on the `Test` type. We must derive `Reflect` here /// too (or ignore it) -#[derive(Reflect, FromReflect)] +#[derive(Reflect)] pub struct Bar { b: usize, } -#[derive(Default)] pub struct NonReflectedValue { _a: usize, } @@ -88,9 +87,6 @@ fn setup(type_registry: Res) { // DynamicStruct type. "Value types" will be deserialized as themselves. let _deserialized_struct = reflect_value.downcast_ref::(); - // A dynamic type can be converted back into a concrete one using the FromReflect trait - let _deserialized_concrete_value: Foo = Foo::from_reflect(&*reflect_value).unwrap(); - // Reflect has its own `partial_eq` implementation, named `reflect_partial_eq`. This behaves // like normal `partial_eq`, but it treats "dynamic" and "non-dynamic" types the same. The // `Foo` struct and deserialized `DynamicStruct` are considered equal for this reason: