Closed MrGVSV closed 2 years ago
Add ability to insert prototype data on existing entities.
Added default trait method to Prototypical called insert, which takes an EntityCommands object. Its usage looks something like:
Prototypical
insert
EntityCommands
fn attach_components(entity: &mut EntityCommands, data: &ProtoData, asset_server: &AssetServer) { let proto = data.get_prototype("My Prototype").expect("Should exist!"); proto.insert(entity, data, asset_server).insert(SomeOtherComponent); }
Objective
Add ability to insert prototype data on existing entities.
Solution
Added default trait method to
Prototypical
calledinsert
, which takes anEntityCommands
object. Its usage looks something like: