From cb85010004f2036b4bf2cf6a8346a6cd1347eb41 Mon Sep 17 00:00:00 2001 From: Marshall Date: Wed, 17 Jun 2026 13:59:19 -0400 Subject: [PATCH] Fix: Update deprecated FCoreDelegates and GIsSavingPackages usages for 5.8.0 with ifdefs for older versions --- .../BlueprintComponentReferenceCustomization.cpp | 15 +++++++++++---- .../BlueprintComponentReferenceEditor.cpp | 16 +++++++++++++++- 2 files changed, 26 insertions(+), 5 deletions(-) diff --git a/Source/BlueprintComponentReferenceEditor/BlueprintComponentReferenceCustomization.cpp b/Source/BlueprintComponentReferenceEditor/BlueprintComponentReferenceCustomization.cpp index 184e7d6..4514452 100644 --- a/Source/BlueprintComponentReferenceEditor/BlueprintComponentReferenceCustomization.cpp +++ b/Source/BlueprintComponentReferenceEditor/BlueprintComponentReferenceCustomization.cpp @@ -449,10 +449,17 @@ FPropertyAccess::Result FBlueprintComponentReferenceCustomization::GetValue(FBlu { // Potentially accessing the value while garbage collecting or saving the package could trigger a crash. // so we fail to get the value when that is occurring. - if (GIsSavingPackage || IsGarbageCollecting()) - { - return FPropertyAccess::Fail; - } +#if UE_VERSION_OLDER_THAN(5, 8, 0) + if (GIsSavingPackage || IsGarbageCollecting()) + { + return FPropertyAccess::Fail; + } +#else + if (UE::IsSavingPackage() || IsGarbageCollecting()) + { + return FPropertyAccess::Fail; + } +#endif FPropertyAccess::Result Result = FPropertyAccess::Fail; if (PropertyHandle.IsValid() && PropertyHandle->IsValidHandle()) diff --git a/Source/BlueprintComponentReferenceEditor/BlueprintComponentReferenceEditor.cpp b/Source/BlueprintComponentReferenceEditor/BlueprintComponentReferenceEditor.cpp index f1d866e..104d64f 100644 --- a/Source/BlueprintComponentReferenceEditor/BlueprintComponentReferenceEditor.cpp +++ b/Source/BlueprintComponentReferenceEditor/BlueprintComponentReferenceEditor.cpp @@ -60,13 +60,22 @@ void FBCREditorModule::StartupModule() { ClassHelper = MakeShared(); + // PostEngineInitHandle = FCoreDelegates::OnPostEngineInit.AddRaw(this, &FBCREditorModule::OnPostEngineInit); +#if UE_VERSION_OLDER_THAN(5, 8, 0) PostEngineInitHandle = FCoreDelegates::OnPostEngineInit.AddRaw(this, &FBCREditorModule::OnPostEngineInit); +#else + PostEngineInitHandle = FCoreDelegates::GetOnPostEngineInit().AddRaw(this, &FBCREditorModule::OnPostEngineInit); +#endif } } void FBCREditorModule::OnPostEngineInit() { - FCoreDelegates::OnPostEngineInit.Remove(PostEngineInitHandle); +#if UE_VERSION_OLDER_THAN(5, 8, 0) + FCoreDelegates::OnPostEngineInit.Remove(PostEngineInitHandle); +#else + FCoreDelegates::GetOnPostEngineInit().Remove(PostEngineInitHandle); +#endif #if !UE_VERSION_OLDER_THAN(5, 0, 0) OnReloadCompleteDelegateHandle = FCoreUObjectDelegates::ReloadCompleteDelegate.AddRaw(this, &FBCREditorModule::OnReloadComplete); @@ -96,7 +105,12 @@ void FBCREditorModule::ShutdownModule() { if (GIsEditor && !IsRunningCommandlet()) { +#if UE_VERSION_OLDER_THAN(5, 8, 0) FCoreDelegates::OnPostEngineInit.Remove(PostEngineInitHandle); +#else + FCoreDelegates::GetOnPostEngineInit().Remove(PostEngineInitHandle); +#endif + #if !UE_VERSION_OLDER_THAN(5, 0, 0) FCoreUObjectDelegates::ReloadCompleteDelegate.Remove(OnReloadCompleteDelegateHandle); FCoreUObjectDelegates::ReloadReinstancingCompleteDelegate.Remove(OnReloadReinstancingCompleteDelegateHandle);