How To Make A timer In Unreal Engine The first thing that you need to do is launch Unreal Engine, and create a project. Create a widget by right clicking in the content area, and hover over user interface, then select widget. Drag text onto the widget, and bind the text to a new binding (go to where you set the text, and press create binding).
Create 3 variables. 2 integers, called seconds, and minutes. Make a string variable called time.
Back in your binding, get time, and hook it up to the return value to show on screen, like shown below.
Once you do this, you need to open your event graph, and the first thing to do is make a delay that happens on the widget construction.. Set it to one second. After that delay, set seconds to seconds+1, as shown below.
Next, we will need to make a branch, with the condition of if seconds is more than 60, because if that is true, we will want to set up by 1, and reset seconds to 0. We will append the minutes and seconds, with a : between them. For example, 1:45. Look below to see how the blueprints should look. Note that in the picture below, some of the nodes are set to -, but they should be +.
Once you do this, you are almost done! We will now need to add a custom event, and link it to the beginning of this script, and then call the custom event at the end, so the script repeats, and the seconds go up by 1 every second. The final script should look like the one below. (things from the last picture have been fixed in this one).
The last step is to add make the widget show when you start the game, so to do that, open the level blueprint, and do the create widget node, and the add to viewport node. Select the widget that you just made with the timer for the create widget node.
You can download the source code for this project by clicking here.
I hope you got it to work, if not, contact me.