Explaination:
UGameplayStatics::GetPlayerController function locates a player controller by known player index, but
can return wrong controller under some conditions. This function trivially loops through all existing controllers
in the world and returns n’th controller. It will select a wrong controller if new temporary controller is created for an
existing player and player switched to this controller using Player->SwitchController(NewPC).
How to reproduce:
UGameInstance* Instance = GetGameInstance();
ULocalPlayer* Player = Instance->GetFirstGamePlayer();
AMenuPlayerController* NewMenuController = World->SpawnActor<APlayerController>(APlayerController::StaticClass(), SpawnInfo);
Player->SwitchController(NewMenuController);
// Now any calls of GetPlayerController(World, 0) will return wrong controller
// For example you will unable to quit game using UKismetSystemLibrary::QuitGame
// or using connected blueprint node. I tested on blueprint node, and it ignores quitting attempts
// util controllers are switched back
Desired behaviour:
Always return activated controller for specified player and ignore suspended controllers