pub trait ComponentFactory: Send + Sync {
// Required methods
fn insert(&self, world: &mut World, entity: Entity, value: &Value);
fn insert_lazy(&self, lazy: &LazyUpdate, entity: Entity, value: &Value);
fn name() -> &'static str
where Self: Sized;
}Expand description
All components must have a factory implementing this trait to be able created from a scene config.
You might want to use the impl_component_factory macro.
Required Methods§
Sourcefn insert(&self, world: &mut World, entity: Entity, value: &Value)
fn insert(&self, world: &mut World, entity: Entity, value: &Value)
Build a component from value and insert it into entity of world
Sourcefn insert_lazy(&self, lazy: &LazyUpdate, entity: Entity, value: &Value)
fn insert_lazy(&self, lazy: &LazyUpdate, entity: Entity, value: &Value)
Build a component from value and lazily insert it into entity of world