Is it possible to make it so that I could pass a state to a Plugin constructor so that particular systems are added to particular states and stages?
I basically want to decouple the Plugin to make it more modular, say if someone wanted to use it like this without having access to the code?
Example (the type of a generic state is where i cant get it to work) :
impl MyPlugin {
fn build_with_states(&self, app: &mut App, load_state: State, run_state: State) {
app.
.add_systems(OnEnter(load_state), my_load_system)
.add_systems(Update, my_run_system.run_if(in_state(run_state));
}
}