Stop and clear the timer unreal engine4

i have created 2 buttons one start the timer second stop the timer. i want to clear the timer after press stop button so that next time when i press start it start from starting.but my code start it from where it stop

Use the timer reference variable to clear and / or invalidate it:

Check out other things that timer can do while you’re at it:

311040-annotation-2020-08-23-104623.jpg


The Set Timer by Event node is yet another alternative which may be preferable to Timer by Function as it’s not prone to typos.

5 Likes

So it could look like this, LMB starts the timer, RMB stops it. The light blink with 1s intervals:

You can use a function for this, ofc.

it still not start timer from starting. if i print number with increment then start after stop thenit continue from where it last stop.

What you’re showing here should work fine. The calltimer starts the timer, which executes ONLIGHT every Speed seconds. The stoptimer will stop it.

At this point I believe there might be an issue with how you’re calling it or how you’re reading data off it. Could you show that piece of script?

Or perhaps you could describe how this should work from the end user’s perspective. What is the timer supposed to do in-game?