# Long press buttons in UMG

**URL:** <https://forums.unrealengine.com/t/long-press-buttons-in-umg/328286>\
**Category:** UI\
**Tags:** buttons, unreal-engine, question, UMG\
**Created:** [August 11, 2015, 7:31am UTC](https://forums.unrealengine.com/t/long-press-buttons-in-umg/328286 "2015-08-11T07:31:30Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![FataMorgana\_1](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@FataMorgana\_1](https://forums.unrealengine.com/u/FataMorgana_1)\
**Post date:** [August 11, 2015, 7:31am UTC](https://forums.unrealengine.com/t/long-press-buttons-in-umg/328286/1 "2015-08-11T07:31:30Z")

</div>

I am using UMG buttons for controls, and I need to set up single button press and 2-second press too. Is there any way to make this kind of controls with UMG?

---

<div class="post-metadata">

**Author:** ![WUG-Jonas](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@WUG-Jonas](https://forums.unrealengine.com/u/WUG-Jonas)\
**Post date:** [August 11, 2015, 8:37am UTC](https://forums.unrealengine.com/t/long-press-buttons-in-umg/328286/2 "2015-08-11T08:37:39Z")

</div>

In your button widget blueprint you can setup a flow like this to create that functionality.

Note! “On Pressed Time” is a user created float variable that you need to create by yourself.

 ![53643-buttoncaptime.png](https://d3kjluh73b9h9o.cloudfront.net/original/4X/8/7/9/87986736f79647375a428a59343bec362da5be4b.png)

---

<div class="post-metadata">

**Author:** ![WUG-Jonas](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@WUG-Jonas](https://forums.unrealengine.com/u/WUG-Jonas)\
**Post date:** [August 11, 2015, 8:49am UTC](https://forums.unrealengine.com/t/long-press-buttons-in-umg/328286/3 "2015-08-11T08:49:32Z")

</div>

I updated the flow with “Greater or Equal to” instead of “Greater than”…

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_b02c8cc7](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_b02c8cc7](https://forums.unrealengine.com/u/anonymous_user_b02c8cc7)\
**Post date:** [May 24, 2017, 5:18pm UTC](https://forums.unrealengine.com/t/long-press-buttons-in-umg/328286/4 "2017-05-24T17:18:50Z")

</div>

Hello everybody i have a question that blueprint can be connecte with the Arduino, i mean is posible to connect a botton electronics the out analogic controller the actor via serial? how can i do it? anyone knows? i new about this UE4 and i want to do someting like that , thanks !

---

<div class="post-metadata">

**Author:** ![threepm](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@threepm](https://forums.unrealengine.com/u/threepm)\
**Post date:** [November 1, 2019, 6:32pm UTC](https://forums.unrealengine.com/t/long-press-buttons-in-umg/328286/6 "2019-11-01T18:32:57Z")

</div>

This solution is not going to work correctly, sadly. The get game time in seconds function is returning how long the game has currently been running and will restart at 0 when the game is re-launched. I was hopeful that function would have been a solution to this specific problem regarding getting the elapsed time of an event.

---

<div class="post-metadata">

**Author:** ![Mariusch](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Mariusch](https://forums.unrealengine.com/u/Mariusch)\
**Post date:** [November 17, 2019, 5:18pm UTC](https://forums.unrealengine.com/t/long-press-buttons-in-umg/328286/7 "2019-11-17T17:18:01Z")

</div>

Because it’s not a full solution. It’s just a example how to detect a button press that’s longer then 2 second.  
If you want to make it work then disable “Is Focusable” in the button options.

![292534-isfocusable.png](https://d3kjluh73b9h9o.cloudfront.net/original/4X/3/8/f/38f6e526243d12663cbc4f0864c090ae22ab2166.png)

---

<div class="post-metadata">

**Author:** ![KonPetTsu](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@KonPetTsu](https://forums.unrealengine.com/u/KonPetTsu)\
**Post date:** [November 6, 2021, 2:01pm UTC](https://forums.unrealengine.com/t/long-press-buttons-in-umg/328286/8 "2021-11-06T14:01:26Z")

</div>

Works good!

 ![351716-2021-11-06-17-00-45.png](https://d3kjluh73b9h9o.cloudfront.net/original/4X/7/9/f/79fc9300978cb0f63b472d5dee384bd171acf902.png)

---

<div class="post-metadata">

**Author:** ![KonPetTsu](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@KonPetTsu](https://forums.unrealengine.com/u/KonPetTsu)\
**Post date:** [November 6, 2021, 2:02pm UTC](https://forums.unrealengine.com/t/long-press-buttons-in-umg/328286/9 "2021-11-06T14:02:47Z")

</div>

Do not forget turn off IS FOCUSABLE

---

<div class="post-metadata">

**Author:** ![Ivonny](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Ivonny](https://forums.unrealengine.com/u/Ivonny)\
**Post date:** [December 12, 2022, 9:02am UTC](https://forums.unrealengine.com/t/long-press-buttons-in-umg/328286/10 "2022-12-12T09:02:05Z")

</div>

thank you

---

<div class="post-metadata">

**Author:** ![Fele](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Fele](https://forums.unrealengine.com/u/Fele)\
**Post date:** [May 19, 2023, 11:57am UTC](https://forums.unrealengine.com/t/long-press-buttons-in-umg/328286/11 "2023-05-19T11:57:48Z")

</div>

Just found this thread while looking for the same thing. The Game Time is a nice approach, but is only checks after releasing the button if it has been pressed long enough. So when keeping it pressed, nothing would happen.

There are other solutions with a looping timer adding fractions of the second but I just found another quick solution for this:

The delay will fire after one second, but only if the button is still pressed. If the button gets released earlier, the branch will prevent it from firing.

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/5/7/4/574612b4e4a2a29bf361de3b39cb4a99f4f3cd82.png)
