Drag works every second time

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.

Hello ,

This set up appears to work just fine on my end. It drags every time without any issues.

Quick questions:

  1. Can you reproduce this issue in a clean project?
  2. If so, could you provide any steps that may have been left out of your original post?
  3. Could you check to make sure that there are no other blueprints consuming input?
  4. Could you provide a screen shot of the the rest of the blueprints that are being used?

Hi Rudy,

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):

  1. created HUD widget, Item widget, MainGameMode and MainPlayerController blueprints;
  2. selected MainGameMode in project settings to be default, referred MainPlayerController there.
  3. in MainPlayerController said to “Show Mouse Cursor”.
  4. GameMode blueprint BeginPlay creates HUD instance and adds it to viewport;
  5. Item is [Size Box]-[Border]-[Text] hierarchy. Set some size, color and text there.
  6. Overrode OnMouseButtonDown for Item (with Detect Drag if Pressed as in tutorial for Left Mouse Button);
  7. Overrode OnDragDetected for Item as on attached screenshot;
  8. Dragged a few Item widgets to HUD canvas panel;
  9. 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.

Hello ,

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.

Hello ,

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.

Thank you.

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.

Hello ,

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.

Make it a great day

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?

Hello ,

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.

Make it a great day

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!