Description

This is from a UDN post.

Several gameplay functions, such as level streaming and SoftObjectPtr resolution, depend on the GPlayInEditorID being set when that code is executed in PIE in the editor. That variable is set when ticking, when handling controller input, and in other places like viewport drawing. However, it is not set when handling mouse input. The stack of where this is going wrong is posted above

FScopedSwitchWorldHack and UEditorEngine::OnSwitchWorldForSlatePieWindow attempt to solve this problem but do not do a very good job. It only sets GIsPlayInEditorWorld instead of setting GPlayInEditorID and it does not appear to be called at all when launching PIE in the editor viewport. I'm not sure what's using GIsPlayInEditorWorld but it's definitely set wrong during Play In Editor Viewport and handling slate events.

I'm not sure if this is a core slate problem or a UMG-only problem. I was originally thinking it would be best to fix it in the UMG wrappers like UButton::SlateHandleClicked but the existence of FScopedSwitchWorldHack makes me think it should be fixed there. But I'm not clear on why it doesn't set it for play in editor viewport

 

Steps to Reproduce
  1. Download, extract, and build attached project
  2. Launch SoftObjectPtr project in editor
  3. Open SoftObjectPtrLevel
  4. Click the button
  5. The PIE copy of Cube2 will not be modified, but when exiting PIE you will see the editor copy was
Callstack

UE4Editor-SoftObjectPtr.dll!UStageWidget::RotateActor(float DeltaPitch, float DeltaYaw, float DeltaRoll) Line 10
UE4Editor-CoreUObject.dll!UFunction::Invoke(UObject * Obj, FFrame & Stack, void * const Z_Param__Result) Line 4571
UE4Editor-CoreUObject.dll!UObject::CallFunction(FFrame & Stack, void * const Z_Param__Result, UFunction * Function) Line 769
[Inline Frame] UE4Editor-CoreUObject.dll!FFrame::Step(UObject *) Line 321
UE4Editor-CoreUObject.dll!UObject::ProcessInternal(UObject * Context, FFrame & Stack, void * const Z_Param__Result) Line 981
UE4Editor-CoreUObject.dll!UObject::CallFunction(FFrame & Stack, void * const Z_Param__Result, UFunction * Function) Line 893
[Inline Frame] UE4Editor-CoreUObject.dll!FFrame::Step(UObject *) Line 321
UE4Editor-CoreUObject.dll!UObject::ProcessInternal(UObject * Context, FFrame & Stack, void * const Z_Param__Result) Line 981
UE4Editor-CoreUObject.dll!UFunction::Invoke(UObject * Obj, FFrame & Stack, void * const Z_Param__Result) Line 4571
UE4Editor-CoreUObject.dll!UObject::ProcessEvent(UFunction * Function, void * Parms) Line 1341
[Inline Frame] UE4Editor-UMG.dll!TScriptDelegate<FWeakObjectPtr>::ProcessDelegate(void *) Line 240
UE4Editor-UMG.dll!TMulticastScriptDelegate<FWeakObjectPtr>::ProcessMulticastDelegate<UObject>(void * Parameters) Line 460
[Inline Frame] UE4Editor-UMG.dll!FOnButtonClickedEvent_DelegateWrapper(const TMulticastScriptDelegate<FWeakObjectPtr> &) Line 17
[Inline Frame] UE4Editor-UMG.dll!FOnButtonClickedEvent::Broadcast() Line 17
UE4Editor-UMG.dll!UButton::SlateHandleClicked() Line 189
[Inline Frame] UE4Editor-UMG.dll!TMemberFunctionCaller<UButton,FReply (__cdecl UButton::*)(void)>::operator()() Line 156
[Inline Frame] UE4Editor-UMG.dll!UE4Tuple_Private::TTupleImpl<TIntegerSequence<unsigned int> >::ApplyAfter(TMemberFunctionCaller<UButton,FReply (__cdecl UButton::*)(void)> &&) Line 498
UE4Editor-UMG.dll!TBaseUObjectMethodDelegateInstance<0,UButton,FReply __cdecl(void)>::Execute() Line 597
[Inline Frame] UE4Editor-Slate.dll!TBaseDelegate<FReply>::Execute() Line 537
UE4Editor-Slate.dll!SButton::OnMouseButtonUp(const FGeometry & MyGeometry, const FPointerEvent & MouseEvent) Line 282
[Inline Frame] UE4Editor-Slate.dll!FSlateApplication::RoutePointerUpEvent::__l8::<lambda_1002768c627006711ef2f351a87ec0e7>::operator()(const FArrangedWidget &) Line 5445
UE4Editor-Slate.dll!FEventRouter::Route<FReply,FEventRouter::FToLeafmostPolicy,FPointerEvent,<lambda_1002768c627006711ef2f351a87ec0e7> >(FSlateApplication * ThisApplication, FEventRouter::FToLeafmostPolicy RoutingPolicy, FPointerEvent EventCopy, const FSlateApplication::RoutePointerUpEvent::__l8::<lambda_1002768c627006711ef2f351a87ec0e7> & Lambda) Line 268
UE4Editor-Slate.dll!FSlateApplication::RoutePointerUpEvent(FWidgetPath & WidgetsUnderPointer, FPointerEvent & PointerEvent) Line 5434
UE4Editor-Slate.dll!FSlateApplication::ProcessMouseButtonUpEvent(FPointerEvent & MouseEvent) Line 5932
UE4Editor-Slate.dll!FSlateApplication::OnMouseUp(const EMouseButtons::Type Button, const FVector2D CursorPos) Line 5912
UE4Editor-ApplicationCore.dll!FWindowsApplication::ProcessDeferredMessage(const FDeferredWindowsMessage & DeferredMessage) Line 1940
UE4Editor-ApplicationCore.dll!FWindowsApplication::DeferMessage(TSharedPtr<FWindowsWindow,0> & NativeWindow, HWND__ * InHWnd, unsigned int InMessage, unsigned __int64 InWParam, __int64 InLParam, int MouseX, int MouseY, unsigned int RawInputFlags) Line 2172
UE4Editor-ApplicationCore.dll!FWindowsApplication::ProcessMessage(HWND__ * hwnd, unsigned int msg, unsigned __int64 wParam, __int64 lParam) Line 1406
UE4Editor-ApplicationCore.dll!FWindowsApplication::AppWndProc(HWND__ * hwnd, unsigned int msg, unsigned __int64 wParam, __int64 lParam) Line 726

 

Have Comments or More Details?

There's no existing public thread on this issue, so head over toAnswerHub just mention UE-59417 in the post.

1
Login to Vote

Unresolved
ComponentTools - UMG
Affects Versions4.20
CreatedMay 21, 2018
UpdatedJul 31, 2019