Add temporary fix for level loading

This commit is contained in:
Louis Hobbs 2023-06-29 18:10:31 +01:00
parent 596bae1855
commit 9d32a0a0e3
1 changed files with 5 additions and 2 deletions

View File

@ -3,6 +3,7 @@
#include "PlayerCharacter.h" #include "PlayerCharacter.h"
// You can remove these, this is just to get intellisense to work // You can remove these, this is just to get intellisense to work
#include <string>
#include <Components/CapsuleComponent.h> #include <Components/CapsuleComponent.h>
#include <Kismet/GameplayStatics.h> #include <Kismet/GameplayStatics.h>
@ -80,9 +81,11 @@ void APlayerCharacter::BeginPlay()
void APlayerCharacter::Destroyed() void APlayerCharacter::Destroyed()
{ {
Super::Destroyed(); FString map = GetWorld()->GetMapName();
map.RemoveFromStart("UEDPIE_0_"); // We have to remove this for reason, I don't fully understand at the moment
UGameplayStatics::OpenLevel(this, FName(map), false);
UGameplayStatics::OpenLevel(GetWorld(), FName(GetWorld()->GetMapName())); Super::Destroyed();
} }
// Called every frame // Called every frame