Assigning players numbers to player controllers


It has been a while since I last set up an unreal project from scratch, and I’m having a small problem with this.

I want to have the listen server to always be player 1 and the first player controller to join to always be player 2. I might need a player 3 in future, but I’m not worried with this right now.

What should I do?

I’m trying to set those in AMyPlayerController::PostInitializeComponents(), since that is called by AGameModeBase::Login() when a player connects, but before the actual player spawns.
Doing this will allow me to have an appropriate number when looking for a player spawn (through AMyGameMode::ChoosePlayerStart_Implementation()) and to also take control of a few auxiliary actors present in the level, that depends on the player number.

Can someone please point me in the right direction for determining the player number? :slight_smile: