Why won't my pawn receive input?

I’m setting up a basic game, but I can’t get my custom pawn class to receive input. I setup the class as such:


I created a BP class which inherits from it, and these are the settings
image
image

I created a PlayerController BP and set this setting
image

This amounts to all of the work I did, besides modifying the game settings to spawn my pawn. I have verified the correct pawn is spawning, and it’s being possessed by my custom PlayerController class. My Axis methods print constant logs of value 0, so the input bindings appear to be working. Things I’ve tried:

  • Set pawn to receive input. This throws an error in the logs: “enableinput can only be specified on a pawn for its controller”
  • Create key and InputAction events on both controller/pawn BPs. Nothing happened.
  • Created empty level, and placed a playerstart in the map. Everything spawned correctly, no inputs recorded.
  • Placed the pawn in the level and set it to autopossess, no inputs recorded.

I have a decent bit of experience using Unreal professionally, but haven’t setup a ton of my own projects. What am I missing here?

Did you set your Project Settings → Input - Axis Mapping

Also, you have to define the behavior of your Yaw, Pitch, Role inside the APlanePawn

For example:
APlanePawn::Pitch(float amount) {
//here goes your code
AddMovement(vectorDirection, amount)
}

Check doing that.

Thanks for your reply! Yes, I have setup 2 input actions and 3 input axis. I have created definitions for my input handlers which just log the name of the action they represent. On tick, my axis methods log 0 even when input is pressed, so it appears as if the axis is bound but not receiving input.

Hi!

Don’t see anything wrong with your code, pretty sure the problem lies somewhere you haven’t shown. If you say the axis functions are called it may be the input settings, post a screenshot of them perhaps (you are actually logging the value correctly right?).

image

These are my input axis settings, and my methods all looked like such:

void Pitch(float Amount)
{
    UE_LOG(LogTemp, Display, TEXT("Pitch %f"), Amount);
}

Pitch is a free function?

Oh, no. Sorry, was answering from my phone. It was a member of APlanePawn as shown in the header.

So thanks everyone for their suggestions, but I just created a new project with the exact same code and it worked. I guess this one will remain a mystery.