diff --git a/Source/CommonLoadingScreen/Private/LoadingScreenManager.cpp b/Source/CommonLoadingScreen/Private/LoadingScreenManager.cpp index 0bc508c..b65f6fc 100644 --- a/Source/CommonLoadingScreen/Private/LoadingScreenManager.cpp +++ b/Source/CommonLoadingScreen/Private/LoadingScreenManager.cpp @@ -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(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()