Fatal error when switching level in packaged game

Hello! I’m new to UE4 and I’ve just packaged my first game. However during testing I ran into a problem. It seems to crash whenever I switch levels. The interesting thing is that it only crashes in the packaged version of the game. The map that I’m switching to is the ElvenRuins map which is one of the InfinityBlade assets. The code:

void AMainCharacter::ChangeLevel(FName LevelName)
UWorld* World = GetWorld();
if (World)
FString CurrLevel =World->GetMapName();
FName CurrLevelName(*CurrLevel);
if (CurrLevelName != LevelName)
UGameplayStatics::OpenLevel(World, LevelName);

The function is called when the main character overlaps with a box component. The name is definetly correct on the blueprint (I mean it works in the editor). The only settings that I’ve changed for packaging is that I’ve set Build Configuration to “Shipping” and turned on “Create compressed cooked packages”. I’ve already tried rebuilding all the “Intermediate” and “Saved” folders. Didn’t help. Any ideas why is this happening? Thanks!

Hey zablas,

I see you’re changing level by Level Name. That method of level change is fine, but when Unreal packages game assets it doesn’t detect assets that need to be packaged if they are only referenced by name. In editor this will work fine because in that mode you have access to every asset.

Go to Project Settings > Packaging. There you’ll find a list of maps to cook and you’ll need to add the ElvenRuins map, as well as any other map that is solely referenced by name.

Are you talking about the “List of maps to include in a packaged build” option? If yes, then I simply have to add the .umap files through the file picker window right?

I believe including the .umap files has worked. Thank you!

No problem. :slight_smile:

You are passing this message on to me, do you know why? I would appreciate it if you can help me

I’m getting this issue after switching my project version from 4.26.2 to 4.27.2.

Packaged builds from 4.62.2 work fine, but repackaging in 4.27.2 and trying to play the game crashes whenever I try to level transition.

All my maps to include in packaged build are setup correctly.

Output log from packaged game looks like this:

[2022.03.03-04.47.13:358][838]LogWindows: Could not start crash report client using …/…/…/Engine/Binaries/Win64/CrashReportClient-Win64-Debug.exe
[2022.03.03-04.47.13:358][838]LogMemory: Platform Memory Stats for WindowsNoEditor
[2022.03.03-04.47.13:358][838]LogMemory: Process Physical Memory: 550.54 MB used, 1566.20 MB peak
[2022.03.03-04.47.13:358][838]LogMemory: Process Virtual Memory: 2033.04 MB used, 2344.67 MB peak
[2022.03.03-04.47.13:358][838]LogMemory: Physical Memory: 12556.93 MB used, 52885.09 MB free, 65442.03 MB total
[2022.03.03-04.47.13:358][838]LogMemory: Virtual Memory: 134160360.00 MB used, 57369.79 MB free, 134217728.00 MB total
[2022.03.03-04.47.13:358][838]Message dialog closed, result: Ok, title: The UE4-Orobas Game has crashed and will close, text: Fatal error!

[2022.03.03-04.47.13:358][838]LogWindows: Error: === Critical error: ===
[2022.03.03-04.47.13:358][838]LogWindows: Error:
[2022.03.03-04.47.13:358][838]LogWindows: Error: Fatal error!
[2022.03.03-04.47.13:358][838]LogWindows: Error:
[2022.03.03-04.47.13:358][838]LogWindows: Error: Unhandled Exception: EXCEPTION_ACCESS_VIOLATION reading address 0x0000000000000038
[2022.03.03-04.47.13:358][838]LogWindows: Error:
[2022.03.03-04.47.13:358][838]LogWindows: Error: [Callstack] 0x00007ff67192d053 Orobas.exe!UnknownFunction []

Run it in debugger, and check out the callstack.