Description

An editor-only ensure can trigger during BP compilation when garbage collection cleans up transient components created as part of component replacement. During recompilation, old component instances may temporarily retain stale entries in their AttachChildren array after attached components have already been reattached to the new instance. When the old component is later destroyed during GC, USceneComponent::OnComponentDestroyed() detects this mismatch and emits an ensure.

While the ensure reports a real inconsistency, it can occur during GC triggered by Blueprint compilation (outside of a transaction).

This issue was reproduced locally in UE 5.7 and UE5-Main (CL 49719251).

A workaround was provided to the licensee to relax the ensure condition to also allow garbage collection in SceneComponent.cpp:

#if WITH_EDITORONLY_DATA
const bool bAllowMismatchContext = GIsTransacting || GarbageCollecting();
if (!ensureAlwaysMsgf(
bAllowMismatchContext,
TEXT("Component '%s' has '%s' in its AttachChildren array, however, '%s' believes it is attached to '%s'"),
*GetFullName(),
*Child->GetFullName(),
*Child->GetFullName(),
*Child->GetAttachParent()->GetFullName()))
#endif

Licensee confirmed this workaround fixes the ensure for them.

Steps to Reproduce

A repro project is attached.
1. Open the repro project in UE 5.7 or a newer version.
2. Open the MySkeletalMeshActor BP class.
3. In the Components panel, select the Skeletal Mesh Component.
4. In the Details panel, change the component class from SkeletalMeshComponent to BP_SkeletalComponent (or viceversa).
5. Compile the blueprint.

Result: ensure is hit and appears in the Output Log.

Callstack

> UnrealEditor-Engine.dll!USceneComponent::OnComponentDestroyed::__l156::<lambda_2>::operator()() Line 1615 C++
UnrealEditor-Engine.dll!USceneComponent::OnComponentDestroyed(bool bDestroyingHierarchy) Line 1615 C++
UnrealEditor-Engine.dll!UActorComponent::BeginDestroy() Line 1167 C++
UnrealEditor-Engine.dll!UPrimitiveComponent::BeginDestroy() Line 1903 C++
UnrealEditor-Engine.dll!USkinnedMeshComponent::BeginDestroy() Line 4761 C++
UnrealEditor-CoreUObject.dll!UObject::ConditionalBeginDestroy() Line 1295 C++
UnrealEditor-CoreUObject.dll!UnhashUnreachableObjects(bool bUseTimeLimit, double TimeLimit) Line 6158 C++
UnrealEditor-CoreUObject.dll!UE::GC::PostCollectGarbageImpl<1>(EObjectFlags KeepFlags) Line 5768 C++
UnrealEditor-CoreUObject.dll!UE::GC::FReachabilityAnalysisState::PerformReachabilityAnalysisAndConditionallyPurgeGarbage(bool bReachabilityUsingTimeLimit) Line 5970 C++
[Inline Frame] UnrealEditor-CoreUObject.dll!UE::GC::CollectGarbageInternal(EObjectFlags) Line 5525 C++
UnrealEditor-CoreUObject.dll!CollectGarbage(EObjectFlags KeepFlags, bool bPerformFullPurge) Line 6216 C++
UnrealEditor-Kismet.dll!FBlueprintCompilationManagerImpl::CompileSynchronouslyImpl(const FBPCompileRequest & Request) Line 412 C++
UnrealEditor-UnrealEd.dll!FKismetEditorUtilities::CompileBlueprint(UBlueprint * BlueprintObj, EBlueprintCompileOptions CompileFlags, FCompilerResultsLog * pResults) Line 785 C++
UnrealEditor-Kismet.dll!FBlueprintEditor::Compile() Line 4235 C++
[Inline Frame] UnrealEditor-Kismet.dll!Invoke(void(FBlueprintEditor::*)()) Line 66 C++
[Inline Frame] UnrealEditor-Kismet.dll!UE::Core::Private::Tuple::TTupleBase<TIntegerSequence<unsigned int>>::ApplyAfter(void(FBlueprintEditor::*)() &) Line 326 C++
UnrealEditor-Kismet.dll!TBaseSPMethodDelegateInstance<0,FBlueprintEditor,1,void __cdecl(void),FDefaultDelegateUserPolicy>::ExecuteIfSafe() Line 325 C++
[Inline Frame] UnrealEditor-Slate.dll!TDelegate<void __cdecl(void),FDefaultDelegateUserPolicy>::ExecuteIfBound() Line 631 C++
UnrealEditor-Slate.dll!FUIAction::Execute() Line 139 C++
UnrealEditor-Slate.dll!FUICommandList::ExecuteAction(const TSharedRef<FUICommandInfo const ,1> InUICommandInfo) Line 117 C++
UnrealEditor-Slate.dll!SToolBarButtonBlock::OnClicked() Line 530 C++
[Inline Frame] UnrealEditor-Slate.dll!Invoke(FReply(SToolBarButtonBlock::*)()) Line 66 C++
[Inline Frame] UnrealEditor-Slate.dll!UE::Core::Private::Tuple::TTupleBase<TIntegerSequence<unsigned int>>::ApplyAfter(FReply(SToolBarButtonBlock::*)() &) Line 326 C++
UnrealEditor-Slate.dll!TBaseSPMethodDelegateInstance<0,SToolBarButtonBlock,1,FReply __cdecl(void),FDefaultDelegateUserPolicy>::Execute() Line 308 C++
[Inline Frame] UnrealEditor-Slate.dll!TDelegate<FReply __cdecl(void),FDefaultDelegateUserPolicy>::Execute() Line 614 C++
UnrealEditor-Slate.dll!SButton::ExecuteOnClick() Line 574 C++
UnrealEditor-Slate.dll!SButton::OnMouseButtonUp(const FGeometry & MyGeometry, const FPointerEvent & MouseEvent) Line 442 C++
[Inline Frame] UnrealEditor-Slate.dll!FSlateApplication::RoutePointerUpEvent::__l8::<lambda_2>::operator()(const FArrangedWidget &) Line 5479 C++
UnrealEditor-Slate.dll!FEventRouter::Route<FReply,FEventRouter::FToLeafmostPolicy,FPointerEvent,`FSlateApplication::RoutePointerUpEvent'::`8'::<lambda_2>>(FSlateApplication * ThisApplication, FEventRouter::FToLeafmostPolicy RoutingPolicy, FPointerEvent EventCopy, const FSlateApplication::RoutePointerUpEvent::__l8::<lambda_2> & Lambda, ESlateDebuggingInputEvent DebuggingInputEvent) Line 459 C++
UnrealEditor-Slate.dll!FSlateApplication::RoutePointerUpEvent(const FWidgetPath & WidgetsUnderPointer, const FPointerEvent & PointerEvent) Line 5465 C++
UnrealEditor-Slate.dll!FSlateApplication::ProcessMouseButtonUpEvent(const FPointerEvent & MouseEvent) Line 6050 C++
UnrealEditor-Slate.dll!FSlateApplication::OnMouseUp(const EMouseButtons::Type Button, const UE::Math::TVector2<double> CursorPos) Line 6006 C++
UnrealEditor-ApplicationCore.dll!FWindowsApplication::ProcessDeferredMessage(const FDeferredWindowsMessage & DeferredMessage) Line 3374 C++
UnrealEditor-ApplicationCore.dll!FWindowsApplication::DeferMessage(TSharedPtr<FWindowsWindow,1> & NativeWindow, HWND__ * InHWnd, unsigned int InMessage, unsigned __int64 InWParam, __int64 InLParam, int MouseX, int MouseY, unsigned int RawInputFlags) Line 3903 C++
UnrealEditor-ApplicationCore.dll!FWindowsApplication::ProcessMessage(HWND__ * hwnd, unsigned int msg, unsigned __int64 wParam, __int64 lParam) Line 2311 C++
[Inline Frame] UnrealEditor-ApplicationCore.dll!WindowsApplication_WndProc(HWND__ *) Line 2128 C++
UnrealEditor-ApplicationCore.dll!FWindowsApplication::AppWndProc(HWND__ * hwnd, unsigned int msg, unsigned __int64 wParam, __int64 lParam) Line 2134 C++
[External Code]
[Inline Frame] UnrealEditor-ApplicationCore.dll!WinPumpMessages() Line 124 C++
UnrealEditor-ApplicationCore.dll!FWindowsPlatformApplicationMisc::PumpMessages(bool bFromMainLoop) Line 153 C++
UnrealEditor.exe!FEngineLoop::Tick() Line 5753 C++
[Inline Frame] UnrealEditor.exe!EngineTick() Line 60 C++
UnrealEditor.exe!GuardedMain(const wchar_t * CmdLine) Line 190 C++
UnrealEditor.exe!LaunchWindowsStartup(HINSTANCE__ * hInInstance, HINSTANCE__ * hPrevInstance, char * __formal, int nCmdShow, const wchar_t * CmdLine) Line 266 C++
UnrealEditor.exe!WinMain(HINSTANCE__ * hInInstance, HINSTANCE__ * hPrevInstance, char * pCmdLine, int nCmdShow) Line 334 C++
[External Code]

Have Comments or More Details?

There's no existing public thread on this issue, so head over to Questions & Answers just mention UE-360919 in the post.

0
Login to Vote

Unresolved
ComponentUE - Framework - Blueprint Runtime
Affects Versions5.75.8
CreatedJan 15, 2026
UpdatedFeb 26, 2026
View Jira Issue