I have this weird behavior when following this tutorial:
Before unchecking “Use Mouse for Touch” the drag worked every second time: on first drag you don’t see cursor picking up the widget, on second drag you do. In each cases debugging shows that OnDragDetected gets fired and “Create DragDropOperation” gets executed.
The blueprint of OnDragDetected part is attached. OnMouseButtonDown handled as in tutorial. No OnDrop handling.
Yes, I just reproduced it on a clean project (Blueprint-Empty). One thing I didn’t mention that I’m on Mac.
There doesn’t seem to be anything special in the steps, just the things to make a project work. Here’s what I did step-by-step (hope I memorized it all):
created HUD widget, Item widget, MainGameMode and MainPlayerController blueprints;
selected MainGameMode in project settings to be default, referred MainPlayerController there.
in MainPlayerController said to “Show Mouse Cursor”.
GameMode blueprint BeginPlay creates HUD instance and adds it to viewport;
Item is [Size Box]-[Border]-[Text] hierarchy. Set some size, color and text there.
Overrode OnMouseButtonDown for Item (with Detect Drag if Pressed as in tutorial for Left Mouse Button);
Overrode OnDragDetected for Item as on attached screenshot;
Dragged a few Item widgets to HUD canvas panel;
Ran in New Editor Window, using iPad 2 Portrait screen size.
With these steps the item picks up drag every second time. Going to Project Settings and unchecking Use Mouse for Touch makes it work properly.
Hope this helps. I can send you this test project if it doesn’t.
I tested the steps provided and was unable to reproduce this issue on our end. I tested it both on a PC as well as a Mac but was still unable to see the effect that you are describing. I think that sending your project would be the next step so that I can take a closer look.
We have not heard back from you in a few days, so we are marking this post as Resolved for tracking purposes. If you are still experiencing the issue you reported, please respond to this message with additional information and we will offer further assistance.
Yes, as I was commenting I reproduced the issue on an empty project. If you think that unchecking “Use Mouse for Touch” is a convenient workaround then I go with it.
I gave this one more try and was able to reproduce this issue on our end. I have written up a report ( UE-17581) and I have submitted it to the developers for further consideration. I will provide updates with any pertinent information as it becomes available. I do believe that the workaround you have mentioned is a good one. Thank you for your time and information.
Also, never use the widget detecting the drag, as the default drag visual. A widget can’t be in two places. You should always create a new widget as the default drag visual.
I am running into the exact same issue. The problem is that I can’t use the work around because I am developing for mobile and I NEED the mouse to mimic touch commands. Has there been any progress on this bug?
I went ahead and double checked on this issue for you. I found that the status of this issue has not been changed to fixed as of yet. However, I will be sure to bump up the community interest for this issue. Thank you for your time and information.
I don’t know if this was the same issue I was having, but it might be related and I came across this thread while trying to find a solution to my problem…
I was tying to do a touch drag and drop off of a button. It would work fine if I touched and dragged, then released, but it would give me problems if I tapped without moving. If I moved the mouse, it would still create the on drag. I’m guessing this is because of the cursor simulating a finger being down, but not being clicked, it isn’t really down, I don’t know exactly how the editor simulates this but maybe it’s between two states or something. Anyway, then since the drag operation was created but there wasn’t any touch, I would have to tap again, in order to “drop” and then I could do another drag drop operation.
This seems to be similar to the bug that the OP was reporting where it only functioned every other time.
I came across the solution after a few hours trying almost random things and LOTS of debugging and print strings, I finally had luck by adding a quick branch in between OnDragDetected and CreateDragDropOperation This branch is gated off of IsTouchEvent off of the OnDragDetected’s PointerEvent pin. If true, then it should create the drag drop operation, if false then just return.
Hopefully if this is the same bug, then this workaround will work for you guys until it is actually fixed in the engine!
JTensai, I don’t know if you get a notification when I post an answer to the main question so I’m replying here, too. Check out the answer I posted if you are still having trouble with this bug and see if it works for you… Good luck!