Closed mwbryant closed 1 year ago
When the inspector sets the value to Some(item)
it needs to have a default value for that item.
For that, you need to tell the type registry that item implements default, which you can do using
#[derive(Reflect, Default)]
#[reflect(Default)]
enum Item {}
Interesting! That solved the problem. It might be worth adding "#[reflect(Default)]` to the error message as that was hard to track down for me.
I have a component that has an array of optional enums as one of it's fields. When I try to set the value for one of these from None to Some using the inspector it gives the message:
core::option::Option<project_name::Item> has unconstructable variants: Some, you should register ReflectDefault for all fields.
How am I supposed to do what this message is telling me? ReflectDefault appears to be a struct in bevy but their docs are unhelpful.
Here is the component in question by the way, both of these are registered types with the app: