How to clear all pending input buffer

Is there an API in new Input system to clear the queue of all the pending events?

I’m doing an interactive keybinding and the panel that contains it has some actions on release input, I would like to clear all of those when I finish the interactive binding.

Basically looking for something like:
InputSystem.ClearAllEvents

I’m not sure if you’re looking for this and I never played with this part of the InputSystem, but there is this:
https://docs.unity3d.com/Packages/com.unity.inputsystem@1.2/api/UnityEngine.InputSystem.LowLevel.InputEventBuffer.html#UnityEngine_InputSystem_LowLevel_InputEventBuffer_Reset

What exactly are you trying to do? Maybe resetting actions is easier here?

It sounds like clearing/ignoring events is unlikely to be a good idea, because that implies is our managed state will get out of sync with actual state of devices, which is risking some buttons getting stuck pressed.

1 Like

Hi @dmytro_at_unity

I worked on a legacy code and there are multiple InputAction instances that would listen to input.

I have an option screen that listens to interactive key binding and does the rebinding. However when I perform the rebinding, the Option Screen navigation can be also receives the input after rebinding completed. So I was thinking to clear the input buffer somehow to make that Option panel input action not receives the pending binding.

To give you an example, the option panel gets closed by releasing ESC key or navigated by Arrow keys, now if I hit ESC to cancel rebinding or use an arrow key for rebinding of WSAD, when I release the keys, it would close the panel or change the navigation which is not desirable.

This is a legacy code and The option panel and the keybinding actions using two sepearte instances of InputAction.