Hello!
I am trying to spawn my character and then possess it, but unfortunately I can’t manage to accomplish that. Here is my code:
void ASchulCSGameMode::spawnPlayers(APlayerController *NewPlayer, int team)
{
for (TObjectIterator<ASpawnArea> Itr; Itr; ++Itr)
{
if (team == Itr->getTeam())
{
FVector vec = Itr->returnRandomPoint();
ACharacter* character =(ACharacter*) GetWorld()->SpawnActor
(
ACharacter::StaticClass(),
&vec
);
NewPlayer->Possess(character);
break;
}
}
}
All of this code, is in the GameMode class. I am calling this code from the PostLogin function.
Thanks in advance for your help.