Greetings,
is there a Simple solution to detect, if any key on Keyboard or Gamepad is pressed, so i can switch my Widget depending on what was pressed ?
I have 2 Widgets (Image inside), one with keyboard controls and one for the gamepad.
What i want to archieve is, if any key on the keyboard is pressed, the widget with the controls of the keyboard should be visible and if any button on the gamepad is pressed, the other one should appear.
I know there is a “any key” for the keyboard in the inputs aviable, but how would this work for the gamepad ?
I have no PlayerController, if this is important to have/know.
void ACCharacter::KeyPressed(FKey key)
{
if (key.IsMouseButton() || !key.IsGamepadKey())
{
// this is keyboard or mouse
} else if (key.IsGamepadKey())
{
// this is gamepad
}
}
DetectKey action here is a list of any possible buttons which are supported by UE4.
And it was a real pain to add all these keys with hands (excepting keyboard. u can use Any Key value) in the editor.
In case anybody else knows how to make it better please reply to me.