Fix Level Switching Crash

This commit is contained in:
baz 2024-04-23 23:30:48 +01:00
parent f66dd3784c
commit 63b3ec0819
1 changed files with 4 additions and 1 deletions

View File

@ -35,7 +35,10 @@ void ALevelEndTriggerVolume::OnOverlapBegin(UPrimitiveComponent* OverlappedCompo
{ {
GetCollisionComponent()->OnComponentBeginOverlap.Clear(); GetCollisionComponent()->OnComponentBeginOverlap.Clear();
gameInstance->GetCurrentLevelManager()->LoadNextLevel(NextLevel); if (!NextLevel.IsNull())
{
UGameplayStatics::OpenLevelBySoftObjectPtr(GetWorld(), NextLevel);
}
this->Destroy(); this->Destroy();
} }