From 621ef632bfcd939abbba894048edd647002c14be Mon Sep 17 00:00:00 2001 From: Jamie Greunbaum Date: Fri, 10 Mar 2023 16:31:00 -0500 Subject: [PATCH] ChangePerformanceSettings is now disabled before fade-out, so that the game can still be rendered underneath the load screen while it fades away. --- .../CommonLoadingScreen/Private/LoadingScreenManager.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/Source/CommonLoadingScreen/Private/LoadingScreenManager.cpp b/Source/CommonLoadingScreen/Private/LoadingScreenManager.cpp index 1f42fb7..0bc508c 100644 --- a/Source/CommonLoadingScreen/Private/LoadingScreenManager.cpp +++ b/Source/CommonLoadingScreen/Private/LoadingScreenManager.cpp @@ -171,15 +171,16 @@ class ULoadingScreenWidget *ULoadingScreenManager::ShowLoadingScreen() CSV_EVENT(LoadingScreen, TEXT("Show")); - const UCommonLoadingScreenSettings *Settings = GetDefault(); - UGameInstance *LocalGameInstance = this->GetGameInstance(); - // Eat input while the loading screen is displayed this->StartBlockingInput(); this->LoadingScreenVisibilityChanged.Broadcast(/*bIsVisible=*/ true); // Create the loading screen widget + + const UCommonLoadingScreenSettings *Settings = GetDefault(); + UGameInstance *LocalGameInstance = this->GetGameInstance(); + TSubclassOf LoadingScreenWidgetClass = Settings->LoadingScreenWidget.LoadSynchronous(); if (this->LoadingScreenUMGWidget = CreateWidget(LocalGameInstance, LoadingScreenWidgetClass, NAME_None)) { @@ -209,6 +210,7 @@ class ULoadingScreenWidget *ULoadingScreenManager::ShowLoadingScreen() void ULoadingScreenManager::HideLoadingScreen() { + this->ChangePerformanceSettings(/*bEnableLoadingScreen=*/ false); this->LoadingScreenUMGWidget->BeginFadeOut(); } @@ -221,7 +223,6 @@ void ULoadingScreenManager::RemoveLoadingScreen() this->StopBlockingInput(); this->RemoveWidgetFromViewport(); - this->ChangePerformanceSettings(/*bEnableLoadingScreen=*/ false); this->LoadingScreenUMGWidget->OnLoadScreenOpened.Unbind(); this->LoadingScreenUMGWidget->OnLoadScreenClosed.Unbind();