Skip to content

Instantly share code, notes, and snippets.

@mxgrey
Last active August 7, 2024 14:42
Show Gist options
  • Save mxgrey/dcca1036e56a47f2fd856829e3ff7496 to your computer and use it in GitHub Desktop.
Save mxgrey/dcca1036e56a47f2fd856829e3ff7496 to your computer and use it in GitHub Desktop.
Bevy IntoSystem refusing to accept a system with a generic SystemParam
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