pub fn absorb_bevy_input_system(
egui_wants_input: Res<'_, EguiWantsInput>,
mouse_input: ResMut<'_, ButtonInput<MouseButton>>,
keyboard_input: ResMut<'_, ButtonInput<KeyCode>>,
keyboard_input_messages: ResMut<'_, Messages<KeyboardInput>>,
mouse_wheel_messages: ResMut<'_, Messages<MouseWheel>>,
mouse_button_input_messages: ResMut<'_, Messages<MouseButtonInput>>,
)Expand description
Clears Bevy input message buffers and resets ButtonInput resources if Egui
is using pointer or keyboard (see the write_egui_wants_input_system run condition).
This system isn’t run by default, set EguiGlobalSettings::enable_absorb_bevy_input_system
to true to enable it.
§Considerations
Enabling this system makes an assumption that bevy_egui takes priority in input handling
over other plugins and systems. This should work ok as long as there’s no other system
clearing messages the same way that might be in conflict with bevy_egui, and there’s
no other system that needs a non-interrupted flow of messages.
§Alternative
A safer alternative is to apply run_if(not(egui_wants_any_pointer_input)) or run_if(not(egui_wants_any_keyboard_input)) to your systems
that need to be disabled while Egui is using input (see the egui_wants_any_pointer_input, egui_wants_any_keyboard_input run conditions).