Closed
Description
What problem does this solve or what need does it fill?
When attempting to create a trait object of a Component
, users must specify the storage type as either Component<Storage=TableStorage>
or Component<Storage=SparseStorage>
.
Reproduction:
use bevy::prelude::*;
fn main() {
let boxed_component: Box<dyn Component> = Box::new(Transform::identity());
}
If they do not do so, they receive a compiler error like:
the value of the associated type `Storage` (from trait `bevy::prelude::Component`) must be specified
This is both somewhat confusing to resolve and frustratingly limiting, as you cannot mix and match storage types within types that you intend to store in the same trait object.
What solution would you like?
Somehow refactor the way storage types are recorded (see bevyengine/rfcs#27 for alternate approaches) to avoid this limitation.
Additional context
Encountered when exploring topics related to #3227.