LoadingScreenManager no longer crashes when removing a non-existent loading screen.

This commit is contained in:
Jamie Greunbaum 2023-03-11 16:23:48 -05:00
parent 621ef632bf
commit 9b0016a548

View File

@ -128,9 +128,6 @@ public:
void ULoadingScreenManager::Initialize(FSubsystemCollectionBase &Collection)
{
//FCoreUObjectDelegates::PreLoadMapWithContext.AddUObject(this, &ThisClass::HandlePreLoadMap);
//FCoreUObjectDelegates::PostLoadMapWithWorld.AddUObject(this, &ThisClass::HandlePostLoadMap);
const UGameInstance *LocalGameInstance = this->GetGameInstance();
check(LocalGameInstance);
}
@ -139,9 +136,6 @@ void ULoadingScreenManager::Deinitialize()
{
this->StopBlockingInput();
this->RemoveWidgetFromViewport();
//FCoreUObjectDelegates::PreLoadMap.RemoveAll(this);
//FCoreUObjectDelegates::PostLoadMapWithWorld.RemoveAll(this);
}
bool ULoadingScreenManager::ShouldCreateSubsystem(UObject *Outer) const
@ -185,7 +179,6 @@ class ULoadingScreenWidget *ULoadingScreenManager::ShowLoadingScreen()
if (this->LoadingScreenUMGWidget = CreateWidget<ULoadingScreenWidget>(LocalGameInstance, LoadingScreenWidgetClass, NAME_None))
{
this->LoadingScreenWidget = this->LoadingScreenUMGWidget->TakeWidget();
this->LoadingScreenUMGWidget->OnLoadScreenClosed.BindUObject(this, &ULoadingScreenManager::RemoveLoadingScreen);
}
else
{
@ -210,8 +203,13 @@ class ULoadingScreenWidget *ULoadingScreenManager::ShowLoadingScreen()
void ULoadingScreenManager::HideLoadingScreen()
{
this->ChangePerformanceSettings(/*bEnableLoadingScreen=*/ false);
this->LoadingScreenUMGWidget->BeginFadeOut();
if (this->bCurrentlyShowingLoadingScreen)
{
this->ChangePerformanceSettings(/*bEnableLoadingScreen=*/ false);
this->LoadingScreenUMGWidget->OnLoadScreenClosed.BindUObject(this, &ULoadingScreenManager::RemoveLoadingScreen);
this->LoadingScreenUMGWidget->BeginFadeOut();
}
}
void ULoadingScreenManager::RemoveLoadingScreen()