Download

Problem Encounter in Spawning Different Pawn

Hi Guys! I’m new to unreal engine 4 and still exploring.

I would like to learn how to spawn different pawn according to players’ choice.

After i google about this topic, so far i found this guideline which directly talk about how to spawn different pawn.

But, I’m having some problem when i going through this guideline

https://wiki.unrealengine.com/Spawn_Different_Pawns_For_Every_Player

Also, I had take a look at shooter example code, and the only thing different is this



if (Cast<AShooterAIController>(InController))
{
//shooter example initialize the pawn class in constructor and return this class when an AIController is send.
return BotPawnClass;
}


I understand how shooter example choose which pawn class to spawn
But the code below is confusing me

//Code from the link



UClass* AMyGameMode::GetDefaultPawnClassForController(AController* InController)
{
	AMyPlayerController* PlayerController = Cast<AMyPlayerController>(InController);

	UClass* PawnClass = PawnTypes.Find(PlayerController->CurrentPawnData.Type);

	return PawnClass;
}


Can Someone explain to me what happen in this line?



UClass* PawnClass = PawnTypes.Find(PlayerController->CurrentPawnData.Type);