Use:
UGameplayStatics::CreatePlayer(World, Index,bSpawnActor)
(Docs).
When creating a custom game mode it wasn’t clear in the documentation how ones goes about:
- Spawning a playercontroller
- Spawning a pawn
- assigning both to each other
- and possessing the pawn with the controller
So I basically did it all manually inside InitGame(). This cropped up some unwieldy UI focusing bugs. Once I replaced it with a call to CreatePlayer() things started working as intended. Hope this helps anyone who’s starting out in UE4 with C++.