How do I set input to another PlayerController when we have the option to control multiple characters (in a game where you can control more than one character)?
Tried somtehing like, but it doesn’t work:
APlayerStart* start = PlayerStarts[1];
APlayerController* controller2 = this->SpawnPlayerController(start->GetActorLocation(), start->GetActorRotation());
this->SpawnDefaultPawnFor(controller2, start);
UWorld* const World = ();
APlayerController* PController = World->GetFirstPlayerController();
PController->InputComponent->bBlockInput = 1;
//controller2->InputComponent->bBlockInput = 0;
FConstPlayerControllerIterator itr = World->GetPlayerControllerIterator();
itr++;
APlayerController* chController = itr->Get();
chController->InitInputSystem();
chController->InputComponent->Activate();
chController->bBlockInput = 0;
I blocked the input from the original controller and tried to give input to a new controller.