Last active
August 7, 2024 14:42
-
-
Save mxgrey/dcca1036e56a47f2fd856829e3ff7496 to your computer and use it in GitHub Desktop.
Bevy IntoSystem refusing to accept a system with a generic SystemParam
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use bevy::{ | |
prelude::*, | |
ecs::system::SystemParam, | |
}; | |
fn main() { | |
let mut app = App::new(); | |
// Works | |
app.add_systems(Update, system_without_generic); | |
// Works | |
app.add_systems(Update, system_with_generic::<CustomComponent>); | |
// Fails: Need to use bevy::ecs::system::StaticSystemParam instead | |
app.add_systems(Update, system_with_generic_param::<CustomParam>); | |
} | |
#[derive(SystemParam)] | |
struct CustomParam<'w, 's> { | |
commands: Commands<'w ,'s> | |
} | |
fn system_without_generic( | |
_: CustomParam, | |
) { | |
} | |
#[derive(Component)] | |
struct CustomComponent; | |
fn system_with_generic<C: Component>( | |
_: Query<&'static C>, | |
) { | |
} | |
fn system_with_generic_param<P: SystemParam>( | |
_: P, | |
) { | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment