When is PlayerController initalised?

I am unsure what you mean by pawnA or pawnB yet taken? PlayerController are initialized after the game mode, that’s all I know. But what I did instead of a player controller, I use the


virtual void SetupPlayerInputComponent(class UInputComponent* PlayerInputComponent) override;

within my APawn class to bind all the actions.

It looks like this:



void AMyPawn::SetupPlayerInputComponent(class UInputComponent* PlayerInputComponent) {
    Super::SetupPlayerInputComponent(PlayerInputComponent);
    InputComponent->BindAction("ZoomIn", IE_Pressed, this, &AMyPawn::ZoomIn);
    InputComponent->BindAction("ZoomIn", IE_Released, this, &AMyPawn::ZoomOut);

    InputComponent->BindAxis("MoveForward", this, &AMyPawn::MoveForward);
    InputComponent->BindAxis("MoveRight", this, &AMyPawn::MoveRight);
    ...
}


This way every pawn registers its own bindings and in the Tick method of the pawn I do the actual movement collision whatnot. So for me there is no Player Controller I care of. I do so for a 2 player split screen demo I did. Works very well had no issues.

Since you most likely do a multi client network based game, the server might be best to select which client has what pawn in the current scene but I never did it in the unreal engine up to now.

I just wanted to let you know that you can do the input mapping / setup inside the pawn class once it gets instantiated / spawned + using the pawns tick method for input handling. Works very well for me. You can also do something similar inside a component you attach to an actor / pawn / character which does the binding and input handling on its tick method.