Is this possible? If so, can someone explain how to set it up? I see the timer node, but it only gives the option for seconds. I am probably overthinking it, but can’t figure out how to set it for minutes as well.
Hi, can you please elaborate your issue a bit more I am not really sure what your problem is?
I am trying to create a timer that will display on screen during the game level that will count down in seconds. But, instead of setting it to 90 seconds, for example, I want it to show 1:30.
I convert to text for use in the Hud
i use diferent text widget for each date.
Give this a go.
Awesome! Thanks! I will try this out.
Do I put this in a text bind or separate function? I tried both ways, and neither display my timer on screen.
Do you have issues with displaying the value at all, or with the displayed value, because the conversion that @DevilsD provided should work correctly. You can either make this setup in the text bind function, or if you are planning to use it later on in different classes, you can also make a function of it in a Blueprint Function Library, so you will be able to call it anywhere.
Can you please post a screenshot about your current text binding function, so we can have a look?
When I do it in the text bind, I get the error in the message log. When I call it as a function, nothing renders at all for the timer.
Sorry, just noticed the one float wasn’t connected, but same result.
There are several issues. First, I think binding functions cannot take inputs, so you will need to get the ‘Seconds’ from a variable, or by casting from the function. Second, you did not setup your graph correctly. There is nothing plugged into the modulus node, and you compare your integers against 0 instead of 9.
Ok, changing it to a variable fixed the compiling issue, but it still does not show up when I test play.
Can you make any text to display at all? Try to output some text from this functon does that work? Also, check if the function is still binded to the text, because it unbinded itself for me a couple of times in the past.
When it is not being binded, it displays (but doesn’t count down). But once it is set to bind to this, it diesappears. I tried deleting the text block and recreating it, and still no luck.
It would help if you showed some more images, like your widget design and the binding in the details panel.
However, I believe there used to be a limitation with UMG bindings, which may still be the case, where the name of the output parameter of the function you bind had to be the default ‘ReturnValue’. As I remember, any other name and it would just silently fail. I would guess that may be your problem.
Yes, that fixed it! Thanks!
Okay, just to be clear, so when you set it to bind, is it fails to display any text at all (like the ‘seconds’ variable’s value without converting), or is it only happening when you process the ‘seconds’ variable and convert it to minutes and seconds?
If you cannot display any text at all in the binding function, I think that is a bug then.
I see you managed to fix it. Good luck!
The problem appears to have been the return value was not named “Return Value.” It is displaying the text now, and converting it properly.
One more question, though. How do I set up the clock to NOT go below zero?
Ah, nevermind. I had my clamp connected wrong. Got it working now. Thanks again for all your help!
One more question. Is there a way to pause the clock while looking through inventory windows? I tried using a bool to tick the clock on and off, but it seems to always set it back to zero when the game is paused. When I come back into the game, it says game over, even though the timer is running again, and there is clearly time left on the clock.