-
Notifications
You must be signed in to change notification settings - Fork 221
Frequently Asked Questions
Thomas Schaller edited this page Nov 2, 2017
·
6 revisions
Answer: Only join the required ones plus the Entities
and use Storage::get
to retrieve the optional ones.
type SystemData = (Entities<'a>, ReadStorage<'a, Required>, ReadStorage<'a, Optional>);
fn run(&mut self, (ent, req, opt): Self::SystemData) {
for (e, req) in (&*ent, &req).join() {
let opt: Option<&Optional> = opt.get(e);
// Use components here
}
}