Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to have optional component in system? #234

Closed
selvavm opened this issue Feb 5, 2021 · 2 comments
Closed

How to have optional component in system? #234

selvavm opened this issue Feb 5, 2021 · 2 comments

Comments

@selvavm
Copy link

selvavm commented Feb 5, 2021

Hi,

Is it possible to do similar to below? I wanted to trigger a system with or without B

#[system]
fn hello_world(a: &A, b: &mut Option<B>) {
   if let Some(b) = b {
      println!("Both A and B is present: A={} and B={}", &a.value, &b.value);
   } else {
      println!("Only A is present: A={}", &a.value);
   }
}
@FluffyCreature
Copy link
Contributor

Yes it is! Please refer to: https://amethyst.rs/posts/legion-ecs-v0.3

@selvavm
Copy link
Author

selvavm commented Feb 6, 2021

Thanks and sorry for creating an issue. I was referring only doc.rs for documentation so missed this. Have a good day

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants