# Simulate a buttonpress after some inactivity

**URL:** <https://forums.unrealengine.com/t/simulate-a-buttonpress-after-some-inactivity/407801>\
**Category:** UI\
**Tags:** button, simulate, unreal-engine, Widget, Blueprint, question\
**Created:** [October 24, 2017, 9:45am UTC](https://forums.unrealengine.com/t/simulate-a-buttonpress-after-some-inactivity/407801 "2017-10-24T09:45:51Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![anonymous\_user\_36bad0b6](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_36bad0b6](https://forums.unrealengine.com/u/anonymous_user_36bad0b6)\
**Post date:** [October 24, 2017, 9:45am UTC](https://forums.unrealengine.com/t/simulate-a-buttonpress-after-some-inactivity/407801/1 "2017-10-24T09:45:51Z")

</div>

Is there any way to “simulate” a buttonpress after say 5 minutes of inactivity by the user.

I want my widget blueprint to default back to the welcomescreen after say 5 minutes of inactivity by simulating pressing the HomeButton… I’ve looked everywhere and i can’t seem to find a satisfactory answer.

Could someone explain an easy way to do this?

Thanks!

---

<div class="post-metadata">

**Author:** ![Everynone](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/everynone/32/1135017_2.png) [@Everynone](https://forums.unrealengine.com/u/Everynone)\
**Post date:** [October 24, 2017, 11:04am UTC](https://forums.unrealengine.com/t/simulate-a-buttonpress-after-some-inactivity/407801/2 "2017-10-24T11:04:38Z")

</div>

Create a CustomEvent and connect it to the same node as the normal button. Once 5 mins have gone past, call that CustomEvent and it will execute the nodes the button was connected to:

![217749-sim.png](https://d3kjluh73b9h9o.cloudfront.net/original/4X/4/f/5/4f51b80c874509797c2896559df557831ac80de2.png)

The _OnClicked_ is a genuine UI button event, the _SimulateCancel_ does exactly what it says.

Does it help?

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_36bad0b6](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_36bad0b6](https://forums.unrealengine.com/u/anonymous_user_36bad0b6)\
**Post date:** [October 25, 2017, 1:12am UTC](https://forums.unrealengine.com/t/simulate-a-buttonpress-after-some-inactivity/407801/3 "2017-10-25T01:12:57Z")

</div>

Alright, thanks. After fiddeling around a bit I got it. Thanks for helping me out.

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_36bad0b6](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_36bad0b6](https://forums.unrealengine.com/u/anonymous_user_36bad0b6)\
**Post date:** [October 25, 2017, 2:35am UTC](https://forums.unrealengine.com/t/simulate-a-buttonpress-after-some-inactivity/407801/4 "2017-10-25T02:35:17Z")

</div>

A new problem arrived though. How can I define 5 minutes of INACTIVITY by the user? As it is now the script has no way of knowing that the user already clicked another button and that the custom event from the last button wich tells it to go to the homescreen is no longer valid. Is there any “monitor user activity” node? lol

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_36bad0b6](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_36bad0b6](https://forums.unrealengine.com/u/anonymous_user_36bad0b6)\
**Post date:** [October 25, 2017, 8:03am UTC](https://forums.unrealengine.com/t/simulate-a-buttonpress-after-some-inactivity/407801/5 "2017-10-25T08:03:32Z")

</div>

Nevermind I got it by playing with the boolean values and if statements, it might not look pretty but it works.

---

<div class="post-metadata">

**Author:** ![Everynone](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/everynone/32/1135017_2.png) [@Everynone](https://forums.unrealengine.com/u/Everynone)\
**Post date:** [October 25, 2017, 9:27am UTC](https://forums.unrealengine.com/t/simulate-a-buttonpress-after-some-inactivity/407801/6 "2017-10-25T09:27:53Z")

</div>

> How can I define 5 minutes of  
> INACTIVITY by the user?

In case you ever look for another solution to monitor player’s inactivity:

 ![217838-capture.png](https://d3kjluh73b9h9o.cloudfront.net/original/4X/4/4/d/44df233c1ffcb16d8aedb076cd664fbd90148a59.png)

Pressing any key or moving the mouse will start the countdown, the _BackToMenu_ CustomEvent will fire when the time is up. Moving the mouse or pressing any key will reset the timer and restart the countdown.
