Unable to use `distributive_run_if` with common conditions
Bevy version
0.10.0
What you did
I wanted to add a chain of systems with run condition using distributive_run_if
app.add_systems(
(
update_cursor_position,
update_info,
)
.chain()
.distributive_run_if(resource_equals(UiVisibility(true)))
);
What went wrong
That code doesn't compile because distributive_run_if requires a condition to implement Clone, but all common conditions don't return Clone-able functions.
Additional information
error: the trait bound `impl for<'a> FnMut(bevy::prelude::Res<'a, ui::resources::UiVisibility>) -> bool: Clone` is not satisfied
When fixing this, remember to change the ones in bevy_time and bevy_input too!
We can't necessarily expect all of these conditions to implement Clone, right? Or would we constrain conditions like resource_equals to resources which implement Clone?
This currently poses a problem for
-
resource_equals<T> -
resource_exists_and_equals<T> -
not
The resource conditions would have to expect the Resource type T to be Clone. The not condition returns a CombinatorSystem which isn't Clone.