[Merged by Bors] - Add example for run conditions#7652
Closed
LiamGallagher737 wants to merge 7 commits intobevyengine:mainfrom
LiamGallagher737:main
Closed
[Merged by Bors] - Add example for run conditions#7652LiamGallagher737 wants to merge 7 commits intobevyengine:mainfrom LiamGallagher737:main
LiamGallagher737 wants to merge 7 commits intobevyengine:mainfrom
LiamGallagher737:main
Conversation
Contributor
|
Welcome, new contributor! Please make sure you've read our contributing guide and we look forward to reviewing your pull request shortly ✨ |
mockersf
reviewed
Feb 13, 2023
| // this is useful for small, simple run conditions you don't need to reuse. | ||
| // All the normal rules still apply, all parameters must be read only except for local parameters | ||
| // In this case we will only run if the input counter resource exists and has changed but not just been added | ||
| .run_if(|res: Option<Res<InputCounter>>| { |
Member
Author
There was a problem hiding this comment.
Am I correct in thinking that once #7605 in merged we could do something like this?
.run_if(resource_exists::<InputCounter>())
.and_then(|counter: Res<InputCounter>| counter.is_changed() && !counter.is_added())
Member
There was a problem hiding this comment.
Yep, precisely :) Interestingly, the short circuiting nature would make sure that the second run condition doesn't panic. That's nice.
Co-authored-by: Alice Cecile <[email protected]>
alice-i-cecile
approved these changes
Feb 14, 2023
joseph-gio
reviewed
Feb 17, 2023
Member
joseph-gio
left a comment
There was a problem hiding this comment.
Overall I'm happy with this, I just have a few grammar nitpicks.
Co-authored-by: JoJoJet <[email protected]>
alice-i-cecile
approved these changes
Feb 18, 2023
joseph-gio
approved these changes
Feb 18, 2023
Member
|
bors r+ |
3 tasks
Contributor
|
Timed out. |
Member
|
Github plz. bors r+ |
Contributor
|
Pull request successfully merged into main. Build succeeded:
|
myreprise1
pushed a commit
to myreprise1/bevy
that referenced
this pull request
Feb 18, 2023
Added an example for run conditions. Fixes bevyengine#7646 if we wait till bevyengine#7605 is merged and include some of it features.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Added an example for run conditions. Fixes #7646 if we wait till #7605 is merged and include some of it features.