Skip to content

Conversation

@ItsDoot
Copy link
Contributor

@ItsDoot ItsDoot commented Nov 30, 2025

Objective

We can introduce another layer of traits in order to directly accept boxed conditions as the argument to IntoScheduleConfigs::run_if.

Solution

  • Add IntoBoxedCondition trait which is used to convert IntoSystem conditions and BoxedConditon into BoxedConditions.
  • Rename the ScheduleConfigs::x_inner functions to add_x/set_x and make them public. These are simply the &mut self versions of the functions on IntoScheduleConfigs, so we should expose them.
  • Cleaned up the impl IntoScheduleConfigs for ScheduleConfigs since we now use those add_x functions in the default function implementations in IntoScheduleConfigs.

Testing

Added a new test for supplying a BoxedCondition to run_if.

@ItsDoot ItsDoot added A-ECS Entities, components, systems, and events C-Usability A targeted quality-of-life change that makes Bevy easier to use D-Straightforward Simple bug fixes and API improvements, docs, test and examples S-Waiting-on-Author The author needs to make changes or address concerns before this can be merged labels Nov 30, 2025
@ItsDoot ItsDoot force-pushed the schedule/config-cleanup branch from ace3298 to 3d9f97d Compare November 30, 2025 02:36
@ItsDoot ItsDoot mentioned this pull request Nov 30, 2025
9 tasks
@ItsDoot ItsDoot added S-Needs-Review Needs reviewer attention (from anyone!) to move forward and removed S-Waiting-on-Author The author needs to make changes or address concerns before this can be merged labels Nov 30, 2025
@ecoskey
Copy link
Contributor

ecoskey commented Nov 30, 2025

Could this also be solved by implementing System for Box<dyn System>? Ran into a similar-ish thing here and I wonder if that might be a more direct fix than adding traits (and in my case extra methods/boxing). I know the maintainers have been iffy about that in the past though, so idk.

@ItsDoot
Copy link
Contributor Author

ItsDoot commented Nov 30, 2025

Could this also be solved by implementing System for Box<dyn System>? Ran into a similar-ish thing here and I wonder if that might be a more direct fix than adding traits (and in my case extra methods/boxing). I know the maintainers have been iffy about that in the past though, so idk.

Yea cart has historically wanted to avoid doing that because of potential double/triple-boxing of systems. Note that you can already provide boxed systems via add_systems, this PR is just covering one of the remaining points: run_if.

@hymm
Copy link
Contributor

hymm commented Dec 3, 2025

Rename the ScheduleConfigs::x_inner functions to add_x/set_x and make them public. These are simply the &mut self versions of the functions on IntoScheduleConfigs, so we should expose them.

Not a big fan of these renames add_in_set is a bit confusing if it's add "in set" or "add in" set. What's the motivation here for exposing these methods?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-ECS Entities, components, systems, and events C-Usability A targeted quality-of-life change that makes Bevy easier to use D-Straightforward Simple bug fixes and API improvements, docs, test and examples S-Needs-Review Needs reviewer attention (from anyone!) to move forward

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants