From 63b3ec08191b5df08c7fc35a3f3d424513938308 Mon Sep 17 00:00:00 2001 From: baz Date: Tue, 23 Apr 2024 23:30:48 +0100 Subject: [PATCH] Fix Level Switching Crash --- Source/Nakatomi/LevelEndTriggerVolume.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Source/Nakatomi/LevelEndTriggerVolume.cpp b/Source/Nakatomi/LevelEndTriggerVolume.cpp index a4cfaca..a86a32b 100644 --- a/Source/Nakatomi/LevelEndTriggerVolume.cpp +++ b/Source/Nakatomi/LevelEndTriggerVolume.cpp @@ -35,7 +35,10 @@ void ALevelEndTriggerVolume::OnOverlapBegin(UPrimitiveComponent* OverlappedCompo { GetCollisionComponent()->OnComponentBeginOverlap.Clear(); - gameInstance->GetCurrentLevelManager()->LoadNextLevel(NextLevel); + if (!NextLevel.IsNull()) + { + UGameplayStatics::OpenLevelBySoftObjectPtr(GetWorld(), NextLevel); + } this->Destroy(); }