How to detect double click in a Blueprint?

It’s easy to add OnClick and OnRelease events to a blueprint but there’s no sign of double click.

I could work around this with a timer but Click events are dropped when clicking quickly. I’ve logged OnClick and OnRelease events and when I double-click I see one Click and two Releases! The Project Settings/Input/Mouse Properties/Double Click Time value seems to have no effect on this.

NOTE: I’m wanting to detect the double-click on a specific object, not in general.

I am also interested in the answer to this question! :slight_smile:

Hey,

You could give something like this a try:

This would allow for Double Clicking on an object in the level (Shape_Cube in my example) and executing script only if Double Clicked on the specified object. It’s similar to what you were going for with the timer except I used a delay node and counted the number of clicks before branching (resetting if only one click was registered).

Hope this gives you what you are after!

-W

1 Like

im having trouble finding the click count is that a custom thing or am i just not looking in the right location?

that’s a float variable, you create it yourself, variables are one of the most useful things in ue4, you should get to know them if you haven’t already, however this post is pretty old so i’m guessing you already know that by now :stuck_out_tongue: https://docs.unrealengine.com/latest/INT/Engine/Blueprints/UserGuide/Variables/index.html

Very nice and simple.

You could also use a gate, to avoid using a variable.

2 Likes

This is lightyears better than my post last year. You win this thread!

I turned this idea into a standalone macro that you can use wherever so that it doesn’t conflict with itself. Here’s how you do it:

3 Likes

I dont know how costly ticks are, I found a way of doing it by holding the time that the key was pressed last and only triggered on that key press again (first post, sorry if I’m necoing and old thread, came across it while google in the same thing) .Only my second day trying unreal, I think I’m going to be here a lot

This allows me to detect double key press up and double key press down to run (I also detect hold shift with a different method). To me, this method seems very simply and not costly ???

background: php (zend & cake)/ ai automation, (neural nets) /java/c++ programmer

… but this is all very new to me, I’ve probably done it in a costly manner, but I dont think so

i turned this idea in fast and normal reloading in gun. it is similar in game Escape From Tarkov. :smiley:

Hi is there any way you can do with by triple tapping?

Great hint, !

Hey everyone, I figured out a very cost efficent method that worked very well for me and very easy to make. It used one int to count the clicks and a sequence that triggers a delay after the first click, then you can specify into the switch int, as much as clicks as you want to stuff to happens and the best thing is that it doesnt involve the update tick, let me know if it works for you

1 Like

Funnily enough I was about to post an alternative after reading this thread yesterday (funny as it’s an old thread) - I was looking for a way to separate single and double clicks using a macro and came up with this. My main aim was to avoid single clicks when double clicking.

The branch could be replaced with a switch similarly to how yours was.

4 Likes

antoinegloum’s widget based solution was really nice and clean. But since it uses a variable anyway, there’s really no need for a sequence or gate.
Here’s an easier to read solution that does the same job.

Oh, and I should note that I names the outputs 1st press and double press (rather than 1st and 2nd or single and double), because a 1st press isn’t guaranteed to be a single press (as a second press might still happen), and a subsequent press second is still a 2nd press whereas double press implies it was within the threshold.

Nice, that makes sense, I was canceling the action of the single click when the double click was activated but executing only one of it could make my whole code simpler, I will check if it works in my project. Yeah its a old topic but I always end up here somehow hehe

Thank you for this !

Thanks this one worked perfectly for me