My Posses and Unposses function is not working

		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.

Have you debugged this? What part isn’t working? Have you added logs?

This topic was automatically closed 20 days after the last reply. New replies are no longer allowed.

Privacy & Terms