-
-
Notifications
You must be signed in to change notification settings - Fork 3.7k
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
Add an example teaching users about custom relationships #17443
Add an example teaching users about custom relationships #17443
Conversation
Co-authored-by: Joona Aalto <[email protected]>
Co-authored-by: Joona Aalto <[email protected]>
Co-authored-by: MinerSebas <[email protected]>
…relations-example
Co-authored-by: Kristoffer Søholm <[email protected]>
// even though the entity itself is not yet instantiated in the world. | ||
// This works because Commands will reserve the entity ID before actually spawning the entity, | ||
// through the use of atomic counters. | ||
let alice = commands.spawn(Name::new("Alice")).id(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Crazy question, but where is 'Name' coming from?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a bevy_core
component! It's quite nice!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Minor comments, but overall I think It looks good!
I have no idea what's going on with CI here: I can't reproduce the failures locally or on |
Objective
After #17398, Bevy now has relations! We don't teach users how to make / work with these in the examples yet though, but we definitely should.
Solution
AddRelationship
andRelationshipTarget
to the prelude: the trait methods are really helpful here.Testing
cargo run --example relationships
Notes to reviewers
App
, I've decide to useWorld::run_system_once
+ system functions defined inside ofmain
to do something closer to literate programming.