Better Way to Restart The Level

For Later versions of Unreal instructor said to change play from Simulate to stand loan because reloading the level was crashing. This is painful:

Change it to this:

void APlayerShooterController::GameHasEnded(AActor* EndGameFocus, bool bIsWinner)
{
	Super::GameHasEnded(EndGameFocus, bIsWinner);

	GetWorldTimerManager().SetTimer(RestartTimer, this, &APlayerShooterController::RestartThisLevel, RestartDelay);
}

void APlayerShooterController::RestartThisLevel()
{
	UGameplayStatics::OpenLevel(this, FName(*GetWorld()->GetName()), false);
}

New function created to encapsulate the Open Level. Works in simulate for later versions.

Privacy & Terms