ChangePerformanceSettings is now disabled before fade-out, so that the game can still be rendered underneath the load screen while it fades away.

This commit is contained in:
Jamie Greunbaum 2023-03-10 16:31:00 -05:00
parent cebe626ec4
commit 621ef632bf

View File

@ -171,15 +171,16 @@ class ULoadingScreenWidget *ULoadingScreenManager::ShowLoadingScreen()
CSV_EVENT(LoadingScreen, TEXT("Show")); CSV_EVENT(LoadingScreen, TEXT("Show"));
const UCommonLoadingScreenSettings *Settings = GetDefault<UCommonLoadingScreenSettings>();
UGameInstance *LocalGameInstance = this->GetGameInstance();
// Eat input while the loading screen is displayed // Eat input while the loading screen is displayed
this->StartBlockingInput(); this->StartBlockingInput();
this->LoadingScreenVisibilityChanged.Broadcast(/*bIsVisible=*/ true); this->LoadingScreenVisibilityChanged.Broadcast(/*bIsVisible=*/ true);
// Create the loading screen widget // Create the loading screen widget
const UCommonLoadingScreenSettings *Settings = GetDefault<UCommonLoadingScreenSettings>();
UGameInstance *LocalGameInstance = this->GetGameInstance();
TSubclassOf<ULoadingScreenWidget> LoadingScreenWidgetClass = Settings->LoadingScreenWidget.LoadSynchronous(); TSubclassOf<ULoadingScreenWidget> LoadingScreenWidgetClass = Settings->LoadingScreenWidget.LoadSynchronous();
if (this->LoadingScreenUMGWidget = CreateWidget<ULoadingScreenWidget>(LocalGameInstance, LoadingScreenWidgetClass, NAME_None)) if (this->LoadingScreenUMGWidget = CreateWidget<ULoadingScreenWidget>(LocalGameInstance, LoadingScreenWidgetClass, NAME_None))
{ {
@ -209,6 +210,7 @@ class ULoadingScreenWidget *ULoadingScreenManager::ShowLoadingScreen()
void ULoadingScreenManager::HideLoadingScreen() void ULoadingScreenManager::HideLoadingScreen()
{ {
this->ChangePerformanceSettings(/*bEnableLoadingScreen=*/ false);
this->LoadingScreenUMGWidget->BeginFadeOut(); this->LoadingScreenUMGWidget->BeginFadeOut();
} }
@ -221,7 +223,6 @@ void ULoadingScreenManager::RemoveLoadingScreen()
this->StopBlockingInput(); this->StopBlockingInput();
this->RemoveWidgetFromViewport(); this->RemoveWidgetFromViewport();
this->ChangePerformanceSettings(/*bEnableLoadingScreen=*/ false);
this->LoadingScreenUMGWidget->OnLoadScreenOpened.Unbind(); this->LoadingScreenUMGWidget->OnLoadScreenOpened.Unbind();
this->LoadingScreenUMGWidget->OnLoadScreenClosed.Unbind(); this->LoadingScreenUMGWidget->OnLoadScreenClosed.Unbind();