Search code examples
c++unreal-engine4

UE4(С++) Сan I find out which key was pressed


In the project I need to process pressing numbers, for this I created a special Action Map: ActionMap

After I announce the click handler:

PlayerInputComponent->BindAction("EnterNum", IE_Pressed, this, &AMainPlayer::EnterNum);

Can I know which key was pressed or I should create a handler for each number?


Solution

  • I see what you mean, but unfortunately you have to create a separate method for each number. For example, you can have an action mapping like this:

    Name: Num0
      0
      Num_0
    Name: Num1
      1
      Num_1
    ...........
    

    Then bind every single number with the corresponding method.

    Although I would agree it would be a very useful feature to get the exact number.