-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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
[Merged by Bors] - Add system sets and run criteria example #1909
Conversation
I think I'm CI blocked until this is in: #1906 |
examples/ecs/system_sets.rs
Outdated
// This shows that we can modify existing run criteria results. | ||
// Here we create a _not done_ criteria by piping the output of | ||
// the `done` system and inverting the output. | ||
.with_run_criteria(RunCriteria::pipe("done", inverse.system())), |
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.
The "done"
string realy confused me here, as i thought it was somehow finding the correct function through a string alone. After reading further I realised that this string is actualy a label.
To reduce this confusion, I suggest to use another Type that derives SystemLabel instead.
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.
I varied names slightly to differentiate better.
I wanted to have an example of using the string literal for creating a SystemLabel
since my intuition says there are probably users who would like to uses labels but not create extra types for it.
Hopefully the new names and added comment makes things clearer.
Signed-off-by: Torstein Grindvik <[email protected]>
…sition calls Signed-off-by: Torstein Grindvik <[email protected]>
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 looks good to me. Part of me wants to avoid "piping" run criteria at all as its a pretty niche feature and makes the example harder to follow. But this does do a good job of illustrating its use so I'm down to keep it.
examples/ecs/system_sets.rs
Outdated
.label(PostPhysics) | ||
// `collision` and `sfx` are not ordered with respect to | ||
// each other, and may run in any order | ||
.with_system(collision.system()) |
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.
Small nit: I like to define systems last in system sets as a general pattern. This creates a nice SetConfig -> Systems
order.
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.
Ok! I'm all for consistency. Updated.
examples/ecs/system_sets.rs
Outdated
@@ -51,6 +51,11 @@ fn main() { | |||
App::build() | |||
.add_plugins(DefaultPlugins) | |||
.init_resource::<Done>() | |||
// Note that the system sets added in this example sets their run criteria explicitly. |
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.
nit: "Note that the system sets added in this example set their run criteria explicitly."
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.
Fixed.
* Typo: sets -> set * Reorder system sets to add systems last Signed-off-by: Torstein Grindvik <[email protected]>
Yes the pipe usage was a bit shoehorned in. |
bors r+ |
If accepted, fixes #1694 . I wanted to explore system sets and run criteria a bit, so made an example expanding a bit on the snippets shown in the 0.5 release post. Shows a couple of system sets, uses system labels, run criterion, and a use of the interesting `RunCriterion::pipe` functionality.
Pull request successfully merged into main. Build succeeded: |
If accepted, fixes bevyengine#1694 . I wanted to explore system sets and run criteria a bit, so made an example expanding a bit on the snippets shown in the 0.5 release post. Shows a couple of system sets, uses system labels, run criterion, and a use of the interesting `RunCriterion::pipe` functionality.
If accepted, fixes #1694 .
I wanted to explore system sets and run criteria a bit, so made an example expanding a bit on the snippets shown in the 0.5 release post.
Shows a couple of system sets, uses system labels, run criterion, and a use of the interesting
RunCriterion::pipe
functionality.