Description
What problem does this solve or what need does it fill?
As a plugin author I publish components and implement Reflect
for them so that the consumers of my plugin can use them in serialized scenes.
Theses components may live in private modules and be re-exported from a parent module like this:
mod my_private_module {
#[derive(Debug, Copy, Clone, Default, Component, Reflect]
#[reflect(Component)]
pub struct AwesomeComponent;
}
// Expose the component without the user knowing about `my_private_module`
pub use my_private_module::AwesomeComponent;
This as the advantage that moving the component to another module or rename/move the module is not a breaking change for the consumers of my library.
But when serialized via bevy's reflection system, it exposes the real path of the component. So moving my Component is now a breaking change. And that's annoying.
What solution would you like?
I would like to be able to choose (hard-code) the path of my components. Maybe like this:
#[derive(Debug, Copy, Clone, Default, Component, Reflect]
#[reflect(Component)]
#[reflect(rename = "myplugin::AwesomeComponent")] // <-- Choose a type name
pub struct AwesomeComponent;;
What alternative(s) have you considered?
I could not move my components (annoying for me). Or I could publish a breaking change (annoying for my users).
Additional context
Serde has a somewhat similar feature:
Metadata
Metadata
Assignees
Labels
Type
Projects
Status