What is the correct way to check if an InputAction callback is issued from a keyboard binding?

Actually I am looking if.context.control.device.name contains “keyboard”, is it safe to do like this?

Bit more robust.

if (context.control.device is Keyboard)
   Debug.Log("Keyboard");

There’s also OnControlsChanged which can be used to determine what kind of control setup is being used ATM.

1 Like