Ergonomics of re-using run conditions #18312
Labels
A-ECS
Entities, components, systems, and events
C-Feature
A new feature, making something new possible
C-Usability
A targeted quality-of-life change that makes Bevy easier to use
S-Needs-Design
This issue requires design work to think about how it would best be accomplished
What problem does this solve or what need does it fill?
I often create run_conditions like so:
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<S>
in its arguments and not&Res<S>
.So currently I just do
if world.get_resource::<S>.is_some_and(...)
where I basically repeat the logic.
I know that I could make a common function that takes
&Res<S>
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 callworld.get_resource::<S>
where in fact I'd just like to have something likeOr 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
)The text was updated successfully, but these errors were encountered: