Ergonomics of re-using run conditions
- Dominant language
- Rust
- Stars
- 48.2k
- Forks
- 4.8k
- Avg merge
- 3d 22h
- Merged PRs (30d)
- 161
Description
## What problem does this solve or what need does it fill?
I often create run_conditions like so:
```
fn f(res: Res) {}
```
which I can use when editing my schedule.
But then often I need to re-use the run_condition inside my Commands, or when I have World access.
Unfortunately I cannot directly re-use the run_condition because it has `Res` in its arguments and not `&Res`.
So currently I just do `if world.get_resource::.is_some_and(...)`
where I basically repeat the logic.
I know that I could make a common function that takes `&Res` as input to avoid the logic being repeated, but it's still a bit of ergonomic painpoint that i need to always do that. Also it means I would have to still have to manually call `world.get_resource::` where in fact I'd just like to have something like
```
if world.run_condition_true(f)
```
Or maybe I can just use `run_system_once`? But i'm not sure about the performance implications. (also it requires `&mut World` instead of `&World`)
Contributor guide
Assessment
This issue has not been assessed yet.