loading screen crash 4.10

Thank you for letting us know that you are experiencing the same crash. This bug report is still being investigated by our developers, and there is currently no timeline for when a fix will be released.

Have a great day

Is there any news or any Workarround known? We just want a loadingscreen. One might start to wonder how a “next gen” engine can not handle a proper loadingscreen wihtout a crash.

Are you still experiencing this issue if you upgrade to the 4.12 Preview?

We’ve had similar trouble with our loading screen when using TakeWidget() to use an UMG widget with the MoviePlayer. What we did wrong was creating a widget in the level blueprint and then pass a reference to the C++ GameInstance that is used in the project. I’m still not sure exactly why the crash occurs, but I’m guessing it’s 'cause the level is getting unloaded while loading the other level, but the loading widget that was passed to the game instance is still tied to the old level.

We’ve made some changes and the crash is yet to occur, so hopefully it’s fixed :slight_smile: here’s the setup in the MyGameInstance.h file:

FLoadingScreenAttributes LoadingScreen;

// Loading screen widget
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Widgets")
TSubclassOf<class UUserWidget> wLoading;

and here’s the stuff from the MyGameInstance.cpp

void MyGameInstance::Init()
{
	UGameInstance::Init();

	FCoreUObjectDelegates::PreLoadMap.AddUObject(this, &MyGameInstance::BeginLoadingScreen);
	FCoreUObjectDelegates::PostLoadMap.AddUObject(this, &MyGameInstance::EndLoadingScreen);
}

void MyGameInstance::BeginLoadingScreen()
{
	LoadingScreen.bAutoCompleteWhenLoadingCompletes = false;

	UUserWidget* LoadingWidget = nullptr;

	if (wLoading) {
		LoadingWidget = CreateWidget<UUserWidget>(this, wLoading);
		if (LoadingWidget) {
			LoadingScreen.WidgetLoadingScreen = LoadingWidget->TakeWidget();
			if (IsMoviePlayerEnabled()) {
				if (LoadingScreen.IsValid()) {
					GetMoviePlayer()->SetupLoadingScreen(LoadingScreen);
				}
			}
		}
	}
}

void MyGameInstance::EndLoadingScreen()
{

}

And then we’ve derived a blueprint from the MyGameInstance class and implemented a LoadLevel function to do this:

This could have probably been done in the C++ class but it works just as well. If anyone has any suggestions on how to improve this stuff, I’d appreciate the feedback. The crash isn’t occurring anymore so I hope this helps someone that has had similar trouble!

Hi, Its solved now in 4.12!

I use the following method:

GetMoviePlayer()->OnPrepareLoadingScreen().AddUObject(this, &UMyGameInstance::ShowLoadingScreen);

This is not enough if you are using seamless travel like us. Therefore i also hooked the PreClientTravel() method of the controller and call the ShowLoadingScreen there as well. This works all fine for UMG widgets!

Hi,

A small update on this issue. In 4.12 it seems to be quite stable and although we did experience rare crashes during the loading screen. It seems having to do with the garbage collector cleaning up our textures. My fix is far from perfect, but at the moment i have the following code in place to prevent my widget from being garbage collected. This seems to fix all issues we had. The issue is probably related to using a UMG widget in the loading screen, so my expectation is that any UObject* references you have in an umg widget need this explicit reference. These would be things such as brushes etc.

LoadingScreen.WidgetLoadingScreen = NewLoadingScreenMovie->TakeWidget(); 
NewLoadingScreenMovie->AddToRoot();
UBorder* BackgroundBorder = Cast<UBorder>(NewLoadingScreenMovie->GetWidgetFromName("BackGroundBorder"));
if (BackgroundBorder)
{
    BackgroundBorder->Background.GetResourceObject()->AddToRoot();
}

I am still getting the same issue in 4.14. As caveman said, more dynamic elements you use (textures setup in construction script etc), the more likely it is to crash. For me, it crashes 20% of times …

Does anyone have a workaround for this issue? What are we doing wrong, has anyone tried creating a widget purely in Slate?

Have a look at my fix for the explicit garbage collection dependency. We are using that fix for some time now (although very ugly) to make it not crash. To figure out which part of a widget is causing it you have to attach your debugger and when it crashes find out for which widget it was looking (typically its looking for an image within some other widget like a border, that gives you the clue). You can use my code above to add a hard reference to the garbage collector (using the name in the umg widget, so give all your widgets explicit names). I would think any reference to images needs this reference. I still do not understand why the images are being garbage collected, since i traced every object and they seem to be uproperty(), which should guarantee garbage collection prevention when still needed.

We are able to repro even with just using a Slate widget, not UserWidget in 4.15.

class SLoadingScreenWidget : public SCompoundWidget
{

public:

	SLATE_BEGIN_ARGS(SLoadingScreenWidget) {}
	SLATE_END_ARGS()

	void Construct(const FArguments& InArgs)
	{
		ChildSlot
		[
				SNew(SOverlay)
				+ SOverlay::Slot()
			.HAlign(HAlign_Fill)
			.VAlign(VAlign_Fill)
			[
				SNew(SSafeZone)
				.VAlign(VAlign_Bottom)
			.HAlign(HAlign_Right)
			.Padding(10.0f)
			.IsTitleSafe(true)
			[
				SNew(SThrobber)
				.Visibility(this, &SLoadingScreenWidget::GetLoadIndicatorVisibility)
			]
			]
		];
	}

private:

	EVisibility GetLoadIndicatorVisibility() const
	{
		return EVisibility::Visible;
	}
};

if (GetMoviePlayer().IsValid() && GetMoviePlayer().Get() != NULL)
	{
		FLoadingScreenAttributes LoadingScreen;
		LoadingScreen.bAutoCompleteWhenLoadingCompletes = true;
		LoadingScreen.MinimumLoadingScreenDisplayTime = 1.0f;
		LoadingScreen.bMoviesAreSkippable = false;
		LoadingScreen.bWaitForManualStop = false;
		LoadingScreen.WidgetLoadingScreen = SNew(SLoadingScreenWidget);
		GetMoviePlayer()->SetupLoadingScreen(LoadingScreen);
	}
	else
	{
		UE_LOG(LogOnline, Warning, TEXT("UBaseGameInstance::BeginLoadingScreen: Unable to get movie player!"));
	}

The crash never occurs on the first loadingscreen, but going from level to level, at one point it will crash with same logs as shown above by other people.