playerstart = Cast<APlayerStart>(FindPlayerStart(C, TEXT("Runner")));
if (ensure(playerstart))
{
UWorld* world = GetWorld();
if (ensure(world))
{
if (ensure(RunnerCharacter)) //RunnerCharacter is TSubclassOf<ARunnerCharacter>
{
pc->UnPossess();
FActorSpawnParameters SpawnParms;
AActor* SpawnedActor = world->SpawnActor<ARunnerCharacter>(
RunnerCharacter->StaticClass(),
playerstart->GetActorLocation(),
playerstart->GetActorRotation(), SpawnParms);
APawn* PossesTo = Cast<APawn>(SpawnedActor);
pc->Possess(PossesTo);
}
}
}
This Code is not working
This line of code is Operating inside of Gamemode::HandleSeamlessTravelPlayer(AController*& C)
(I’ve made it with virtual overrided)
Seems like UnPosses and Posses is not working.