How do I display the value of a variable on a widget?

I’m making a simple racing game, and i’m very new to Unreal.

Firstly, how would I pause a timer (thats counting up in integers) on the event of overlapping a trigger box.

Secondly, how would I then display the current integer being shown in a text box on a widget?

The simplest way would be putting text widget and bind function to text varable that will convert integer you want to string and put current value in widget text. You can read about binding here:

As for pausing timer… i don’t know, since i don’t know your current set up, as it seem you not using timers, whatever you doing just stop counting time when some “pause” bool is true. If you would use timers there a function for pause:

https://docs.unrealengine.com/en-us/Gameplay/HowTo/UseTimers/Blueprints

1 Like

The timer tutorial was too specific to the fire example they were using, and when I try to bind the text box in the end screen widget to the integer variable I cant reference the time. I just need a way to stop the integer counter I have acting as a timer, and bind the total time to a text box; no tutorial I find is really helpful. Sorry if i’m being troublesome, I don’t have experience with the engine.

This isn’t a real set-up FYI I just modified some blueprints from other things I made to help answer other questions so this is not a straightforward method to copy. However, it does have a timer that sets a number in a widget to count upwards. On overlap of a trigger volume the timer stops counting and the number displayed on the screen remains unchanged. Depending on where your variables are located and where your trigger volume is referenced and where the widget is created will determine what kind of casting needs to be done. But other than that, this is the basic set up.

Is your goal to create a new text element whenever something is triggered, which just shows a snapshot of the time it was triggered,
or do you want to have the text element continually showing the time progression updating, but then freeze when triggered?

Have the text element continually showing the time progression updating, then freeze when triggered. Sorry that the question isn’t very clear.

My answer below does exactly that. Have you tried modifying it for your purposes?

Ok. I will upload screen shots later for you that are more generic and hopefully easier to implement. It’s not hard to do what you want

I had difficulty finding the right nodes and setting up a blueprint that would work with my project, i’m not entirely sure what specifically was wrong. When I tried compiling there were errors (if I recall) to do with targets that I couldn’t figure out. For now I have a basic solution that keeps the number in the top left the same, but hasn’t paused it; 1 is subtracted from the number as 1 is added so the value is constantly the same.

I hope this is more helpful for how you can create the functionality you desire. That “++” node is called an “increment” if you have trouble finding it. Basically it just adds +1 to the “counter” variable and sets it to the new value each time it is called.