Yea Ok. So fundamentally one pawn can only be possessed by one controller. When you possess the player pawn with an AI controller the player controller automatically unposseses(?) the pawn. In that case your player controller has no longer any pawn that controls. This is why you can’t get UInputComponent
.
Keyboard events propagate from the controller down to the pawn. Check Input Processing Procedure here.
I am not sure what are you trying to achieve here but try to keep the player having a pawn even if it is an ObserverPawn and if you want pawn independent inputs add the mapping context to the Player Controller.
P.S.
I can’t seem to find the line where you actually try to get UInputComponent
and receive the error. The code snippet might be relevant