Crash during PIE

I have crash while playing in PIE. The c++ code compiles fine - I have browsed blueprints and did not find any major issues.

Other thing - how should I read this bug trace? I can see that in my SGameMode something wrong is with starting game. It points to line 72 but that is calling super method of StartMatch.

Access violation - code c0000005 (first/second chance not available)

UE4Editor_CoreUObject!UObject::ProcessInternal() [d:\build\++ue4+release-4.19+compile\sync\engine\source\runtime\coreuobject\private\uobject\scriptcore.cpp:985]
UE4Editor_CoreUObject!UFunction::Invoke() [d:\build\++ue4+release-4.19+compile\sync\engine\source\runtime\coreuobject\private\uobject\class.cpp:4551]
UE4Editor_CoreUObject!UObject::ProcessEvent() [d:\build\++ue4+release-4.19+compile\sync\engine\source\runtime\coreuobject\private\uobject\scriptcore.cpp:1345]
UE4Editor_Engine!AActor::ProcessEvent() [d:\build\++ue4+release-4.19+compile\sync\engine\source\runtime\engine\private\actor.cpp:687]
UE4Editor_Engine!AActor::BeginPlay() [d:\build\++ue4+release-4.19+compile\sync\engine\source\runtime\engine\private\actor.cpp:3140]
UE4Editor_Engine!AActor::DispatchBeginPlay() [d:\build\++ue4+release-4.19+compile\sync\engine\source\runtime\engine\private\actor.cpp:3107]
UE4Editor_Engine!AWorldSettings::NotifyBeginPlay() [d:\build\++ue4+release-4.19+compile\sync\engine\source\runtime\engine\private\worldsettings.cpp:189]
UE4Editor_Engine!AGameMode::HandleMatchHasStarted() [d:\build\++ue4+release-4.19+compile\sync\engine\source\runtime\engine\private\gamemode.cpp:234]
UE4Editor_Engine!AGameMode::SetMatchState() [d:\build\++ue4+release-4.19+compile\sync\engine\source\runtime\engine\private\gamemode.cpp:350]
UE4Editor_Engine!AGameMode::StartMatch() [d:\build\++ue4+release-4.19+compile\sync\engine\source\runtime\engine\private\gamemode.cpp:211]
UE4Editor_SurvivalGame!ASGameMode::StartMatch() [c:\users\wisnia\documents\survivalproject\source\survivalgame\private\world\sgamemode.cpp:72]
UE4Editor_Engine!UWorld::BeginPlay() [d:\build\++ue4+release-4.19+compile\sync\engine\source\runtime\engine\private\world.cpp:3536]
UE4Editor_Engine!UGameInstance::StartPlayInEditorGameInstance() [d:\build\++ue4+release-4.19+compile\sync\engine\source\runtime\engine\private\gameinstance.cpp:355]
UE4Editor_UnrealEd!UEditorEngine::CreatePIEGameInstance() [d:\build\++ue4+release-4.19+compile\sync\engine\source\editor\unrealed\private\playlevel.cpp:3274]
UE4Editor_UnrealEd!UEditorEngine::PlayInEditor() [d:\build\++ue4+release-4.19+compile\sync\engine\source\editor\unrealed\private\playlevel.cpp:2410]
UE4Editor_UnrealEd!UEditorEngine::StartQueuedPlayMapRequest() [d:\build\++ue4+release-4.19+compile\sync\engine\source\editor\unrealed\private\playlevel.cpp:1271]
UE4Editor_UnrealEd!UEditorEngine::Tick() [d:\build\++ue4+release-4.19+compile\sync\engine\source\editor\unrealed\private\editorengine.cpp:1581]
UE4Editor_UnrealEd!UUnrealEdEngine::Tick() [d:\build\++ue4+release-4.19+compile\sync\engine\source\editor\unrealed\private\unrealedengine.cpp:401]
UE4Editor!FEngineLoop::Tick() [d:\build\++ue4+release-4.19+compile\sync\engine\source\runtime\launch\private\launchengineloop.cpp:3339]
UE4Editor!GuardedMain() [d:\build\++ue4+release-4.19+compile\sync\engine\source\runtime\launch\private\launch.cpp:166]
UE4Editor!GuardedMainWrapper() [d:\build\++ue4+release-4.19+compile\sync\engine\source\runtime\launch\private\windows\launchwindows.cpp:144]
UE4Editor!WinMain() [d:\build\++ue4+release-4.19+compile\sync\engine\source\runtime\launch\private\windows\launchwindows.cpp:223]
UE4Editor!__scrt_common_main_seh() [f:\dd\vctools\crt\vcstartup\src\startup\exe_common.inl:253]
kernel32
ntdll

Please post a screenshot of the the code you think is causing the issue.

I have commented out all code in custom StartMatch to be just calling super method and I still get the error. I have created new level with none set as GameMode or setting it to default one and I still get similar error.

The access violation is usually because you have a null pointer somewhere in your code. Double check to make sure that you’re not trying to get something that doesn’t exist (or never initialized), or add checks in your code.You’re going to have to do proper debugging to get to the bottom of the error.

Take a look at this answer on a similar issue, the selected answer has some great info on debugging this kind of error:

Also perhaps you’re calling something in your code too early. Sometimes when you create a reference for something in the constructor and not BeginPlay, the thing you are referencing doesn’t exist yet because it hasn’t yet loaded into the world, since the constructor stuff is called first.

See the reference for this in the thread below:

https://forums.unrealengine.com/development-discussion/c-gameplay-programming/48798-accessing-game-instance-crash

If you really think that everything is correct in code, you might need to rebuild your project. Do this by deleting your Binaries and Intermediate folders, along with the .vs folder. After that, right-click the .uproject file and Generate Visual Studio Project files. This will repopulate some of the intermediates and remake the .sln. After that, open up the .sln and build the project. Then try it again.

Reference for this info:

I’m just shooting in the dark here since I can’t see your code. But maybe this will lead you in the right direction.

Ok I upgraded to 4.20-preview and I noticed error in custom GameMode class in Init method where I had Native projection as some kind of hack … removed that, rolled back to 4.19 and it works.