-
I've simplified my code down to the bare minimum to describe the problem. The goal is to remove a lot of boilerplate I have. I'm not sure what needs to be done in order for use bevy::{
prelude::*,
ecs::system::SystemParam,
};
pub trait Trait {
type Assoc: SystemParam + Send + Sync + 'static;
fn system(query: Self::Assoc) {
}
}
#[derive(Default)]
pub struct MyPlugin<T: Trait + Send + Sync>(std::marker::PhantomData<T>);
impl<T: Trait + Send + Sync + 'static> Plugin for MyPlugin<T> {
fn build(&self, app: &mut App) {
app.add_systems(Update, T::system);
}
}
fn main() {}
|
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
You should use SystemParamItem for the system parameters type instead of SystemParam. I have a branch with an improved example here https://github.com/hymm/bevy/blob/3ab4f50cbf3082057df10b1d72accd55e83ae8e3/examples/ecs/generic_system.rs#L146 |
Beta Was this translation helpful? Give feedback.
You should use SystemParamItem for the system parameters type instead of SystemParam. I have a branch with an improved example here https://github.com/hymm/bevy/blob/3ab4f50cbf3082057df10b1d72accd55e83ae8e3/examples/ecs/generic_system.rs#L146