How do I stop an event / Timer on Key Release?


I have a BeginonEventPlay which calls a looping event “DOF magic” with a timer.

But I want to configure this in such a way that a Keypress will trigger it and KeyRelease will stop it. ( It’s a Post Process Effect )
I tried using a branch node but I am not sure how to stop the event or the timer.


The SetTimer node returns a TimerHandle. You can use your handle to communicate with that given Timer. Your other option is the ClearTimerByFunctionName node.

You just call SetTimer on the key Pressed event, and call ClearTimer on the Released event.

Hi Kontur
Thanks a lot,
This method worked, but partially.

The timer stopped. But the my DOF_Magic was still executing after my key release.
I had my debug marker running when I hit the key press and it stopped when I released the key. But the DOF magic will still running. How can I stop this function entirely and restart the timer loop on key press?


Hi Kontur
I have used this method to override my Focus Distance on Key release. So it’s working as I want it now.
But I would like to know how to stop a function from executing entirely as well.



The way I do it.

But the problem I have is… timers always start with a delay. I need shooting to happen immediately.

So fire the function immediately, and then start the timer.

How to add and delete timer in Unreal Tournament 4 properly?