Skip to content

Commit 684c821

Browse files
committed
Schedule gilrs system before input systems (#2989)
# Objective Previously, the gilrs system had no explicit relationship to the input systems. This could potentially cause it to be scheduled after the input systems, leading to a one-frame lag in gamepad inputs. This was a regression introduced in #1606 which removed the `PreEvent` stage ## Solution This adds an explicit `before` relationship to the gilrs plugin, ensuring that raw gamepad events will be processed on the same frame that they are generated.
1 parent 49a4009 commit 684c821

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

crates/bevy_gilrs/src/lib.rs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@ mod converter;
22
mod gilrs_system;
33

44
use bevy_app::{App, CoreStage, Plugin, StartupStage};
5+
use bevy_ecs::schedule::ParallelSystemDescriptorCoercion;
6+
use bevy_input::InputSystem;
57
use bevy_utils::tracing::error;
68
use gilrs::GilrsBuilder;
79
use gilrs_system::{gilrs_event_startup_system, gilrs_event_system};
@@ -22,7 +24,10 @@ impl Plugin for GilrsPlugin {
2224
StartupStage::PreStartup,
2325
gilrs_event_startup_system,
2426
)
25-
.add_system_to_stage(CoreStage::PreUpdate, gilrs_event_system);
27+
.add_system_to_stage(
28+
CoreStage::PreUpdate,
29+
gilrs_event_system.before(InputSystem),
30+
);
2631
}
2732
Err(err) => error!("Failed to start Gilrs. {}", err),
2833
}

0 commit comments

Comments
 (0)