PlayerController.cpp line 5563 - Why is blueprint Tick called after PlayerTick and not before?

I tried to put all my First-Person controller inputs on the PlayerController blueprint, while this works for the movement, the rotation broke.

I searched the source code and found that custom actor Tick(DeltaSeconds) at line 5563 is called after PlayerTick(DeltaSeconds) on line 5526 (which calls UpdateRotation). Right after the Tick, the RotationInput is cleared. This means that any calls to AddYawInput, or AddControllerYawInput inside PlayerController tick are going to be erased.

I wonder if this is by design. Is the PlayerController not meant to get rotation input and pass it to the Pawn? In a multi-character scenario, are we supposed to add rotation input code ourselves to the pawn?

The solution would be to call Tick() before PlayerTick().

You, didn’t mention it so I’ll assume, you’re using Enhanced Input. If not then you need to start using it.

I don’t think you’re supposed to put all your input handling in PlayerController. This is a place for inputs that should be available to the player regardless of controlled pawn. “Open menu” for example.

Enhanced input system provides you with enough flexibility to handle inputs on per pawn basis without cluttering the codebase much.

For example in the project I’m working on we’re storing IAs and IMCs on pawns, and other actors that can be used (inventory system) by player. Then when they become relevant, PlayerController pulls all that data and rebuilds the inputs.

“I wonder if this is by design.”

With this engine it could be anything tbh. The engine is updated by epic based on whatever new plugin they are working on.