Does functions SetupPlayerInputComponent and SetupInputComponent the same?
When shoud I use SetupPlayerInputComponent() and SetupInputComponent()
virtual void SetupPlayerInputComponent(UInputComponent * PlayerInputComponent )
virtual void SetupInputComponent()
If I recall correctly, SetupPlayerInputComponent is defined in Pawn.h and SetupInputComponent is defined in PlayerController.h.
If you’d like input to be processed by the PlayerController then set up bindings in SetupInputComponent, if you’d like input to be processed by the Character (Pawn), then set up bindings in SetupPlayerInputComponent.
Back in the day with UDK/UE3 it seemed like the standard approach to processing input flowed as follows:
PlayerInput => PlayerController => Pawn
In UE4 it seems this flow is not really important, and people set up their bindings where they make the most sense.
I’ve only ever set up input bindings in PlayerController in special cases where I had a very thin PlayerController that performed specific UI functions.
One thing to note is (again, if I recall correctly) input is consumed fully - e.g. if you bind an axis mapping to a function in both SetupPlayerInputComponent and SetupInputComponent, it will only fire for one of them (I think the controller).