Keypress not firing in children BPs

Hi everyone,

I have a little issue with detecting key press. The solutions might be really simple but I’m a beginner. Of course I’ve searched. I think that I’ve created my project using mobile/tablet mode.

I want to detect when a key is pressed inside an Actor BP. Here is how I go :

I’ve also tried to debug with breakpoints but this code is never triggered.

This code is in a BP that inherit from another. His parent do all the things to enable input :

138245-capture.png

An important note (I think ?) I’m not sure to have a PlayerController in my world. I’m trying to do a little Guitar-Hero like so when I started the project, I’ve cleaned up some things (and this help me to understand some things).

There’s a bit more information that is needed to know why your input isn’t being triggered.

  1. What blueprint class are you calling the input event with? Is it a pawn blueprint or some other actor?
  2. As you’ve stated yourself as a beginner, do you know if your player controller has possessed the actor you’re expecting to control? If it’s a pawn, then the game will do this for you with proper gamemode configuration.
  3. You should setup action mappings for your input events instead (see documentation)

What you need to know is that all player input is captured with a player controller. You do not spawn player controllers in your level as the gamemode will take care of this for you. As a player in the game, you inherently have a player controller because of this. If you want to directly interact with an actor via a player’s input, then the player controller needs to possess that actor. In most cases, a player controller will possess a pawn since the pawn class is designed to be possessed by a controller. Hope that helps.

Thanks for your reply.

  1. It is an actor blueprint

  2. Now my BP inherits from Pawn, I’ve manually set Auto Possess Player to my Player 0 and I’ve disabled AI Controller since I don’t have any AI stuff.

  3. I know that, but it’s just for debugging. I’m working on a mobile game and at the end the inputs will come from an external controller. At the moment the external controller isn’t finished yet so I’m using “hard codded” inputs. Maybe there is a better way ? I think about mappings with the controller but I haven’t looked yet if this is possible and how to do that :).

Very clear advises, thanks a lot.

With this new setup, it doesn’t seems to works yet

I was able to print as expected with the setup described in this documentation. You shouldn’t need to modify any configuration on the actor to get this input working as you’ve described in Step 2. If you can’t achieve the expected result with a blank actor, then you might be experiencing input conflict since you said that the actor inherits from another actor that handles all your input. If that’s the case, you’ll have to architecture your code appropriately to avoid input conflict or you can configure something with input priority.

If you got a Begin Play in your Child BP make sure to right Click the Event and add Call to parent. Otherwise you simply overwrite the Functionality in your Child BP and never call the parents Functionality.

Aside from that you can have Input Conflicts if more than 1 Object in your World uses your Input Event (even if it is the same Object!). They follow a certain priority order who executes the Input event first not sure about the order but expect something like Controllers before Pawns before Actors etc. and for Actors I think its the last spawned has higher priority than any other Actor.

Now if you click on your Input you notice some options in the Details panel. As you can see there is a Consume Input checkbox that basicly says if I execute the Input its “Handled” nobody else need to recive the Event. If you uncheck it you basicly say I recived the Event, I done my thing with it and if somebody else wants todo something with it feel free todo so until someone “Consumes” the Input.

Thats about it.

I had the same problem. I created a blueprint actor class and made a child class from it. I had other stuff working in the child, but couldn’t detect any keyboard input - not even using the “any key” node. I’ve even tried creating a new blueprint actor class and still couldn’t detect any keyboard input in that graph either.

Then I found the solution. Class Defaults > Input > Auto Receive Input needs to be changed from the default (disabled) to player 0. Then using the following setup in the graph will work for any keyboard input you want to add.

NOTE: You need to spawn a player in PIE when testing. Using the “simulate” option won’t work.