GameModeBase Different Pawns


I am trying to have different pawns spawned depending on which class the client picks before connecting to the server. I’ve read a few posts (mainly A new, community-hosted Unreal Engine Wiki - Announcements - Unreal Engine Forums ) however it’s pretty outdated. Seeing is GetDefaultPawnClassForController isn’t virtual anymore, how do I go about accomplishing this?


I know this is late but I was having the same problem following the same tutorial today. I’ll post what I did in case someone else runs in to it.

In your header all you need to do is change

UClass* GetDefaultPawnClassForController(AController* InController) override;


UClass* GetDefaultPawnClassForController_Implementation(AController* InController) override;

Then in your cpp file implement it like

UClass* YOURCLASSNAME::GetDefaultPawnClassForController_Implementation(AController* InController)

I’m pretty new to Unreal so there could be a better way, but this worked for me.