IyesGames / iyes_loopless

Alternatives to Bevy States, FixedTimestep, Run Criteria, that do not use "stage looping" and are composable
Other
249 stars 27 forks source link

Bevy 0.9 support #43

Closed Cifram closed 2 years ago

Cifram commented 2 years ago

I attempted to update my project to Bevy 0.9, which was just released a few days ago, and the majority of the iyes_loopless functionality broke.

Specifically, it seems most of the new methods added to App are not being found, like add_loopless_state, add_exit_system and add_enter_system. These all have the very simple error in the form:

no method named `add_loopless_state` found for struct `bevy::prelude::App` in the current scope

It also can't find the run_in_state method when I try to call it on one of my systems when adding it to the app. It works when called directly on a ConditionSet (or at least I'm not seeing a compilation error on it yet). The error I get on this is much more complicated and hard to make sense of, given the extensive layered generics. This is an example:

the method `run_in_state` exists for fn item `for<'r, 's, 't0, 't1, 't2, 't3, 't4, 't5, 't6, 't7> fn(bevy::prelude::Commands<'r, 's>, bevy::prelude::Query<'t0, 't1, (&'t2 mut ButtonInteraction, &'t3 PowerButton)>, bevy::prelude::Query<'t4, 't5, &'t6 mut PowerMenu>, bevy::prelude::Res<'t7, bevy::prelude::Input<bevy::prelude::KeyCode>>) {power_menu_ui_system}`, but its trait bounds were not satisfied
the following trait bounds were not satisfied:
`for<'r, 's, 't0, 't1, 't2, 't3, 't4, 't5, 't6, 't7> fn(bevy::prelude::Commands<'r, 's>, bevy::prelude::Query<'t0, 't1, (&'t2 mut ButtonInteraction, &'t3 PowerButton)>, bevy::prelude::Query<'t4, 't5, &'t6 mut PowerMenu>, bevy::prelude::Res<'t7, bevy::prelude::Input<bevy::prelude::KeyCode>>) {power_menu_ui_system}: bevy_ecs::system::function_system::IntoSystem<(), (), _>`
which is required by `for<'r, 's, 't0, 't1, 't2, 't3, 't4, 't5, 't6, 't7> fn(bevy::prelude::Commands<'r, 's>, bevy::prelude::Query<'t0, 't1, (&'t2 mut ButtonInteraction, &'t3 PowerButton)>, bevy::prelude::Query<'t4, 't5, &'t6 mut PowerMenu>, bevy::prelude::Res<'t7, bevy::prelude::Input<bevy::prelude::KeyCode>>) {power_menu_ui_system}: iyes_loopless::condition::IntoConditionalSystem<_>`
`&for<'r, 's, 't0, 't1, 't2, 't3, 't4, 't5, 't6, 't7> fn(bevy::prelude::Commands<'r, 's>, bevy::prelude::Query<'t0, 't1, (&'t2 mut ButtonInteraction, &'t3 PowerButton)>, bevy::prelude::Query<'t4, 't5, &'t6 mut PowerMenu>, bevy::prelude::Res<'t7, bevy::prelude::Input<bevy::prelude::KeyCode>>) {power_menu_ui_system}: bevy_ecs::system::function_system::IntoSystem<(), (), _>`
which is required by `&for<'r, 's, 't0, 't1, 't2, 't3, 't4, 't5, 't6, 't7> fn(bevy::prelude::Commands<'r, 's>, bevy::prelude::Query<'t0, 't1, (&'t2 mut ButtonInteraction, &'t3 PowerButton)>, bevy::prelude::Query<'t4, 't5, &'t6 mut PowerMenu>, bevy::prelude::Res<'t7, bevy::prelude::Input<bevy::prelude::KeyCode>>) {power_menu_ui_system}: iyes_loopless::condition::IntoConditionalSystem<_>`
`&mut for<'r, 's, 't0, 't1, 't2, 't3, 't4, 't5, 't6, 't7> fn(bevy::prelude::Commands<'r, 's>, bevy::prelude::Query<'t0, 't1, (&'t2 mut ButtonInteraction, &'t3 PowerButton)>, bevy::prelude::Query<'t4, 't5, &'t6 mut PowerMenu>, bevy::prelude::Res<'t7, bevy::prelude::Input<bevy::prelude::KeyCode>>) {power_menu_ui_system}: bevy_ecs::system::function_system::IntoSystem<(), (), _>`
which is required by `&mut for<'r, 's, 't0, 't1, 't2, 't3, 't4, 't5, 't6, 't7> fn(bevy::prelude::Commands<'r, 's>, bevy::prelude::Query<'t0, 't1, (&'t2 mut ButtonInteraction, &'t3 PowerButton)>, bevy::prelude::Query<'t4, 't5, &'t6 mut PowerMenu>, bevy::prelude::Res<'t7, bevy::prelude::Input<bevy::prelude::KeyCode>>) {power_menu_ui_system}: iyes_loopless::condition::IntoConditionalSystem<_>`

Also, Bevy now requires all resources to explicitly #[derive(Resource)]. This is breaking the NextState resource.

Further, the trait bounds that ConditionalSet::with_system uses seems to be broken, as every single system I try to add that way is now generating an error that it does not implement the required trait bounds. The error message is again a mess of layered generics that's hard to make sense of, but this is an example, pulled from one of my simplest systems:

the trait bound `for<'r, 's, 't0, 't1, 't2> fn(bevy::prelude::Res<'r, bevy::prelude::Time>, bevy::prelude::Query<'s, 't0, (&'t1 Drag, &'t2 mut Velocity)>) {drag_system}: bevy_ecs::system::function_system::IntoSystem<(), (), _>` is not satisfied
the trait `AddConditionalToSet<ConditionSystemSet, ()>` is implemented for `ConditionalSystemDescriptor`
required for `for<'r, 's, 't0, 't1, 't2> fn(bevy::prelude::Res<'r, bevy::prelude::Time>, bevy::prelude::Query<'s, 't0, (&'t1 Drag, &'t2 mut Velocity)>) {drag_system}` to implement `iyes_loopless::condition::IntoConditionalSystem<_>`
required for `for<'r, 's, 't0, 't1, 't2> fn(bevy::prelude::Res<'r, bevy::prelude::Time>, bevy::prelude::Query<'s, 't0, (&'t1 Drag, &'t2 mut Velocity)>) {drag_system}` to implement `AddConditionalToSet<ConditionSystemSet, _>`r

I'm sure there are other incompatibilities as well, but these are the ones I'm currently seeing.

inodentry commented 2 years ago

in git now; i want to investigate a few more issues before i publish a release