mirror of
https://github.com/bevyengine/bevy
synced 2024-12-21 10:33:08 +00:00
9d804a231e
# Objective Sometimes you want to create a plugin with a custom run condition. In a function, you take the `Condition` trait and then make a `BoxedCondition` from it to store it. And then you want to add that condition to a system, but you can't, because there is only the `run_if` function available which takes `impl Condition<M>` instead of `BoxedCondition`. So you have to create a wrapper type for the `BoxedCondition` and implement the `System` and `ReadOnlySystem` traits for the wrapper (Like it's done in the picture below). It's very inconvenient and boilerplate. But there is an easy solution for that: make the `run_if_inner` system that takes a `BoxedCondition` public. Also, it makes sense to make `in_set_inner` function public as well with the same motivation. ![image](https://github.com/bevyengine/bevy/assets/61053971/a4455180-7e0c-4c2b-9372-cd8b4a9e682e) A chunk of the source code of the `bevy-inspector-egui` crate. ## Solution Make `run_if_inner` function public. Rename `run_if_inner` to `run_if_dyn`. Make `in_set_inner` function public. Rename `in_set_inner` to `in_set_dyn`. ## Changelog Changed visibility of `run_if_inner` from `pub(crate)` to `pub`. Renamed `run_if_inner` to `run_if_dyn`. Changed visibility of `in_set_inner` from `pub(crate)` to `pub`. Renamed `in_set_inner` to `in_set_dyn`. ## Migration Guide --------- Co-authored-by: Alice Cecile <alice.i.cecile@gmail.com> Co-authored-by: Joseph <21144246+JoJoJet@users.noreply.github.com> |
||
---|---|---|
.. | ||
executor | ||
condition.rs | ||
config.rs | ||
graph_utils.rs | ||
mod.rs | ||
schedule.rs | ||
set.rs | ||
state.rs |