Description

The licensee has noticed that the deletion of a transient actor still marks the scene as dirty and asks it to be saved.
Checking the source it was noted that the transient flag is not verified on deletion.
They identified the origin of the issue resides on UUnrealEdEngine::DeleteActors(), more specifically on this snippet:
// Modify the level. Each level is modified only once.
// @todo DB: Shouldn't this be calling UWorld::ModifyLevel?
ULevel* Level = Actor->GetLevel();
if (LevelsAlreadyModified.Find(Level) == INDEX_NONE)

{ LevelsAlreadyModified.Add(Level); // Don't mark the level dirty when deleting external actors and the level is in `use external actors` mode. bool bShouldDirty = !(Actor->IsPackageExternal() && Level->IsUsingExternalActors()); Level->Modify(bShouldDirty); }

They suggest the setting of bShouldDirty to:
bool bShouldDirty = !((Actor->IsPackageExternal() && Level->IsUsingExternalActors()) || Actor->HasAnyFlags(RF_Transient));
That way the flag is also checked.

Steps to Reproduce

On an empty project create a C++ Actor, in the repro project I've named mine MyActor
Add Transient and Blueprintable to it's UCLASS()
Compile and open the project
Create a Blueprint from the created C++ Actor (BP_TransientActor in the repro)
Dragging the BP to a scene will not mark a scene as dirty/to be saved, as expected, because the BP is transient and should not be serialized
Now delete the spawned BP from the scene
Expected Result: the deletion of a transient actor should not mark the scene as dirty
Actual Result: the deletion of the transient actor marks the scene as dirty

Callstack

> UnrealEditor-UnrealEd.dll!UUnrealEdEngine::DeleteActors(const TArray<AActor *,TSizedDefaultAllocator<32>> & InActorsToDelete, UWorld * InWorld, UTypedElementSelectionSet * InSelectionSet, const bool bVerifyDeletionCanHappen, const bool bWarnAboutReferences, const bool bWarnAboutSoftReferences) Line 1224 C++
UnrealEditor-UnrealEd.dll!UActorElementEditorWorldInterface::DeleteElements(TArrayView<FTypedElementHandle const ,int> InElementHandles, UWorld * InWorld, UTypedElementSelectionSet * InSelectionSet, const FTypedElementDeletionOptions & InDeletionOptions) Line 77 C++
UnrealEditor-Engine.dll!FTypedElementCommonActionsCustomization::DeleteElements(ITypedElementWorldInterface * InWorldInterface, TArrayView<FTypedElementHandle const ,int> InElementHandles, UWorld * InWorld, UTypedElementSelectionSet * InSelectionSet, const FTypedElementDeletionOptions & InDeletionOptions) Line 30 C++
UnrealEditor-LevelEditor.dll!FActorElementLevelEditorCommonActionsCustomization::DeleteElements(ITypedElementWorldInterface * InWorldInterface, TArrayView<FTypedElementHandle const ,int> InElementHandles, UWorld * InWorld, UTypedElementSelectionSet * InSelectionSet, const FTypedElementDeletionOptions & InDeletionOptions) Line 24 C++
UnrealEditor-Engine.dll!UTypedElementCommonActions::DeleteNormalizedElements(const TSharedPtr<TTypedElementList<FTypedElementHandle> const ,1> & ElementListPtr, UWorld * World, UTypedElementSelectionSet * SelectionSet, const FTypedElementDeletionOptions & DeletionOptions) Line 83 C++
UnrealEditor-Engine.dll!UTypedElementCommonActions::DeleteSelectedElements(UTypedElementSelectionSet * SelectionSet, UWorld * World, const FTypedElementDeletionOptions & DeletionOptions) Line 62 C++
UnrealEditor-UnrealEd.dll!UUnrealEdEngine::Exec_Actor(UWorld * InWorld, const wchar_t * Str, FOutputDevice & Ar) Line 2610 C++
UnrealEditor-UnrealEd.dll!UUnrealEdEngine::Exec(UWorld * InWorld, const wchar_t * Stream, FOutputDevice & Ar) Line 725 C++
UnrealEditor-UnrealEd.dll!UEditorEngine::Exec_Editor(UWorld * InWorld, const wchar_t * Stream, FOutputDevice & Ar) Line 5640 C++
UnrealEditor-Core.dll!FExec::Exec(UWorld * InWorld, const wchar_t * Cmd, FOutputDevice & Ar) Line 18 C++
UnrealEditor-Engine.dll!UEngine::Exec(UWorld * InWorld, const wchar_t * Cmd, FOutputDevice & Ar) Line 4759 C++
UnrealEditor-UnrealEd.dll!UUnrealEdEngine::Exec(UWorld * InWorld, const wchar_t * Stream, FOutputDevice & Ar) Line 662 C++
UnrealEditor-LevelEditor.dll!FLevelEditorActionCallbacks::ExecuteExecCommand(FString Command) Line 2033 C++
[Inline Frame] UnrealEditor-LevelEditor.dll!Invoke(void[Image Removed](FString) &) Line 47 C++
UnrealEditor-LevelEditor.dll!??$ApplyAfter@AEBQ6AXVFString@@@Z$$V@?$TTupleBase@U?$TIntegerSequence@I$0A@@@VFString@@@Tuple@Private@Core@UE@@QEGBA?A_TAEBQ6AXVFString@@@Z@Z(void[Image Removed](FString) & Func) Line 309 C++
UnrealEditor-LevelEditor.dll!TBaseStaticDelegateInstance<void __cdecl(void),FDefaultDelegateUserPolicy,FString>::ExecuteIfSafe() Line 777 C++
[Inline Frame] UnrealEditor-Slate.dll!TDelegate<void __cdecl(void),FDefaultDelegateUserPolicy>::ExecuteIfBound() Line 570 C++
UnrealEditor-Slate.dll!FUIAction::Execute() Line 139 C++
UnrealEditor-Slate.dll!FUICommandList::ConditionalProcessCommandBindings(const FKey Key, bool bCtrl, bool bAlt, bool bShift, bool bCmd, bool bRepeat) Line 235 C++
UnrealEditor-Slate.dll!FUICommandList::ProcessCommandBindings(const FKeyEvent & InKeyEvent) Line 179 C++
UnrealEditor-UnrealEd.dll!SEditorViewport::OnKeyDown(const FGeometry & MyGeometry, const FKeyEvent & InKeyEvent) Line 143 C++
UnrealEditor-LevelEditor.dll!SLevelViewport::OnKeyDown(const FGeometry & MyGeometry, const FKeyEvent & InKeyEvent) Line 724 C++
[Inline Frame] UnrealEditor-Slate.dll!FSlateApplication::ProcessKeyDownEvent::__l22::<lambda_2>::operator()(const FArrangedWidget &) Line 4789 C++
UnrealEditor-Slate.dll!??$Route@VFReply@@VFBubblePolicy@FEventRouter@@UFKeyEvent@@V<lambda_2>@?BG@??ProcessKeyDownEvent@FSlateApplication@@QEAA_NAEBU4@@Z@@FEventRouter@@SA?AVFReply@@PEAVFSlateApplication@@VFBubblePolicy@0@UFKeyEvent@@AEBV<lambda_2>@?BG@??ProcessKeyDownEvent@2@QEAA_NAEBU4@@Z@W4ESlateDebuggingInputEvent@@@Z(FSlateApplication * ThisApplication, FEventRouter::FBubblePolicy RoutingPolicy, FKeyEvent EventCopy, const FSlateApplication::ProcessKeyDownEvent::__l22::<lambda_2> & Lambda, ESlateDebuggingInputEvent DebuggingInputEvent) Line 447 C++
[Inline Frame] UnrealEditor-Slate.dll!FEventRouter::RouteAlongFocusPath(FSlateApplication *) Line 416 C++
UnrealEditor-Slate.dll!FSlateApplication::ProcessKeyDownEvent(const FKeyEvent & InKeyEvent) Line 4785 C++
UnrealEditor-Slate.dll!FSlateApplication::OnKeyDown(const int KeyCode, const unsigned int CharacterCode, const bool IsRepeat) Line 4696 C++
UnrealEditor-ApplicationCore.dll!FWindowsApplication::ProcessDeferredMessage(const FDeferredWindowsMessage & DeferredMessage) Line 2078 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 2750 C++
UnrealEditor-ApplicationCore.dll!FWindowsApplication::ProcessMessage(HWND__ * hwnd, unsigned int msg, unsigned __int64 wParam, __int64 lParam) Line 1919 C++
[Inline Frame] UnrealEditor-ApplicationCore.dll!WindowsApplication_WndProc(HWND__ *) Line 923 C++
UnrealEditor-ApplicationCore.dll!FWindowsApplication::AppWndProc(HWND__ * hwnd, unsigned int msg, unsigned __int64 wParam, __int64 lParam) Line 929 C++
[External Code]
[Inline Frame] UnrealEditor-ApplicationCore.dll!WinPumpMessages() Line 116 C++
UnrealEditor-ApplicationCore.dll!FWindowsPlatformApplicationMisc::PumpMessages(bool bFromMainLoop) Line 145 C++
UnrealEditor.exe!FEngineLoop::Tick() Line 5850 C++
[Inline Frame] UnrealEditor.exe!EngineTick() Line 61 C++
UnrealEditor.exe!GuardedMain(const wchar_t * CmdLine) Line 180 C++
UnrealEditor.exe!GuardedMainWrapper(const wchar_t * CmdLine) Line 118 C++
UnrealEditor.exe!LaunchWindowsStartup(HINSTANCE__ * hInInstance, HINSTANCE__ * hPrevInstance, char * __formal, int nCmdShow, const wchar_t * CmdLine) Line 258 C++
UnrealEditor.exe!WinMain(HINSTANCE__ * hInInstance, HINSTANCE__ * hPrevInstance, char * pCmdLine, int nCmdShow) Line 298 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-243836 in the post.

0
Login to Vote

Unresolved
ComponentUE - World Creation - Worldbuilding Tools
Affects Versions5.4.4
Target Fix5.6
CreatedFeb 6, 2025
UpdatedFeb 7, 2025
View Jira Issue