Crash when loading level from UMG

When trying to load a game level from a UMG menu, the game usually crashes with the below message. It has loaded the game level successfully once out of many times, and will crash on playing the menu again after the crash without restarting the editor.

The blueprint nodes leading to the crash are as follows: OnClicked → Remove All Widgets → Open Level → Remove from Parent.

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

"Assertion failed: IsValid() [File:D:\BuildFarm\buildmachine_++depot+

UE4Editor_CoreUObject!UObjectBaseUtility::GetFullName() [d:\buildfarm\buildmachine_++depot+ue4-releases+4.8\engine\source\runtime\coreuobject\private\uobject\uobjectbaseutility.cpp:77]
UE4Editor_CoreUObject!FArchiveRealtimeGC::PerformReachabilityAnalysis() [d:\buildfarm\buildmachine_++depot+ue4-releases+4.8\engine\source\runtime\coreuobject\private\uobject\garbagecollection.cpp:572]
UE4Editor_CoreUObject!CollectGarbageInternal() [d:\buildfarm\buildmachine_++depot+ue4-releases+4.8\engine\source\runtime\coreuobject\private\uobject\garbagecollection.cpp:1284]
UE4Editor_CoreUObject!CollectGarbage() [d:\buildfarm\buildmachine_++depot+ue4-releases+4.8\engine\source\runtime\coreuobject\private\uobject\garbagecollection.cpp:1336]
UE4Editor_Engine!UEngine::HandleMemCommand() [d:\buildfarm\buildmachine_++depot+ue4-releases+4.8\engine\source\runtime\engine\private\unrealengine.cpp:4147]
UE4Editor_Engine!UEngine::Exec() [d:\buildfarm\buildmachine_++depot+ue4-releases+4.8\engine\source\runtime\engine\private\unrealengine.cpp:2512]
UE4Editor_Engine!UGameEngine::Exec() [d:\buildfarm\buildmachine_++depot+ue4-releases+4.8\engine\source\runtime\engine\private\gameengine.cpp:677]
UE4Editor_Engine!UEngine::LoadMap() [d:\buildfarm\buildmachine_++depot+ue4-releases+4.8\engine\source\runtime\engine\private\unrealengine.cpp:8987]
UE4Editor_Engine!UEngine::Browse() [d:\buildfarm\buildmachine_++depot+ue4-releases+4.8\engine\source\runtime\engine\private\unrealengine.cpp:8360]
UE4Editor_Engine!UEngine::TickWorldTravel() [d:\buildfarm\buildmachine_++depot+ue4-releases+4.8\engine\source\runtime\engine\private\unrealengine.cpp:8535]
UE4Editor_Engine!UGameEngine::Tick() [d:\buildfarm\buildmachine_++depot+ue4-releases+4.8\engine\source\runtime\engine\private\gameengine.cpp:875]
UE4Editor!FEngineLoop::Tick() [d:\buildfarm\buildmachine_++depot+ue4-releases+4.8\engine\source\runtime\launch\private\launchengineloop.cpp:2359]
UE4Editor!GuardedMain() [d:\buildfarm\buildmachine_++depot+ue4-releases+4.8\engine\source\runtime\launch\private\launch.cpp:142]
UE4Editor!GuardedMainWrapper() [d:\buildfarm\buildmachine_++depot+ue4-releases+4.8\engine\source\runtime\launch\private\windows\launchwindows.cpp:126]
UE4Editor!WinMain() [d:\buildfarm\buildmachine_++depot+ue4-releases+4.8\engine\source\runtime\launch\private\windows\launchwindows.cpp:200]

you should not call code from within a widget after using RemoveAllWidgets, because the widget will no longer exist. calling RemoveFromParent is pointless, because its already removed.

maybe your widget should call a level transitioning function in your game mode, and your game mode can remove all widgets and load the next level.

Thanks! I only tried adding RemoveAllWidgets to fix the crash when it didn’t work without it. I tried your solution and it seems to work the first one or two times I try playing the level in a session, but after that it seems to consistently crash with the same error as before.

I’m also trying to use 3D widgets, so I don’t know if that needs to be cleaned up differently.

Hello ,

Widgets are removed automatically in 4.8 when transitioning to a new level. If you simply call the open level node, do you receive this crash?

It works fine when played in the active viewport, but not when playing as standalone. I’ve actually decided to move away from using UMG as it doesn’t fit the design of our game, so this can be marked as resolved. I also don’t mind troubleshooting the issue further if it is helpful to others.

Hello ,

I have a few question for you that will help narrow down the issue.

Quick questions:

  1. Can you reproduce this issue in a clean project?
  2. If so, could your provide a detailed set of steps to reproduce this issue on our end?
  3. Could you provide screen shots of any blueprints that may have been involved with this issue?

I was unable to easily reproduce the issue in a clean project.

Hello ,

Could you provide a detailed list of the steps necessary to reproduce this issue on our end? I will need a reproducible test case in order to write up a report.

  1. Create two new levels (each with a point light, player start and BSP box) in a blank blueprint project with starter content.
  2. Create a new widget blueprint containing a text box in a vertical box in a canvas panel
  3. Create a new actor blueprint with a widget component that has its UI/WidgetClass set to the previous widget blueprint.
  4. Drag actor into the world.
  5. Repeat steps 2-4 for the other level
  6. Add a button containing text to the vertical box of the menu for the first level
  7. In the first menu’s widget blueprint add an event for onButtonClicked → Open Second Level
  8. In the first menu’s actor blueprint, add EventBeginPlay → SetInputModeGameAndUI with the player controller at Index 0 as the target
  9. Run the application in viewport and click the UMG button to load the second level

Hello ,

I was unable to reproduce this issue with the steps provided above. Would it be possible for you to provide a project that reproduces the issue on your end?

Hello ,

We have not heard back from you in a few days, so we are marking this post as Resolved for tracking purposes. If you are still experiencing the issue you reported, please respond to this message with additional information and we will offer further assistance.

Thank you.