Does anyone have a working example of using drag and drop in Slate on iOS? I have it working fine in the mobile preview, but there is something that is causing it to assert and hang when I actually launch it on my iPad.
I started this just before UMG came out and I’m a little more comfortable with code anyhow, so I haven’t tried converting it to UMG yet (plus there is a lot more logic that I’d rather not have to implement in Blueprints if I don’t have to)
Here’s the code I’m using now:
FReply SDraggableIcon::OnTouchStarted( const FGeometry& MyGeometry, const FPointerEvent& InTouchEvent )
{
GEngine->AddOnScreenDebugMessage(-1, 5.f, FColor::Red, TEXT("Touch Started!"));
const TSharedRef<SWidget> DetectDragInMe = SharedThis(this);
return FReply::Handled().DetectDrag( DetectDragInMe,EKeys::TouchKeys[0]);
}
FReply SDraggableIcon::OnDragDetected( const FGeometry& MyGeometry, const FPointerEvent& MouseEvent )
{
GEngine->AddOnScreenDebugMessage(-1, 5.f, FColor::Red, TEXT("Drag Detected!"));
TSharedRef<FNodeDragDrop> DragPayload( new FNodeDragDrop(NodeType, nullptr, IconImage));
return FReply::Handled().BeginDragDrop(DragPayload);
}
On the iPad it displays the “Touch Started!” message but never the “Drag Detected!” message, so it must be getting hung up somewhere in the DetectDrag function. I also get this message in the debug output when I run it in debug mode from XCode:
Assertion failed: IsValid() [File:/Users/build/BuildFarm/build_++depot+UE4-Releases+4.5/Engine/Source/Runtime/Core/Public/Templates/SharedPointer.h] [Line: 658]
But I can’t set breakpoints (I just asked a different question on that one if anyone has ideas) to determine exactly what variable is causing the assert on IsValid()
So I’m stuck and any ideas or examples you can refer me to would be much appreciated!