So yesterday I got a day/night cycle in my project and then I thought it would be nice to have an in-game clock somewhere. I built myself a widget and I made a blueprint able to show the in-game clock but since I’m using an event tick I’m trying to change the format and I’m a bit in the dark here. So the hour display shows something like “16.78”. I’d like to make to changes to that : first, show a colon instead of a comma and secondo, don’t let the minutes go over 60.
I’m pretty sure I should use the append function to make a colon but I have absolutely no idea how to get the minutes.
You can assign your time variable to a string, then do a replace on your string to convert the decimal to a colon. Then in your tick timer, you can do an if statement to see if its over 60 to put it back to 0
maybe though take a step back and see how others have implemented this - doing this on tick will be really cpu intensive
I googled in game clock on youtube and found some good tutorials for you
That last tutorial was pretty close to what I already had and gave me some good tips and ideas and I was finally able to get what I wanted. One of the only part I was missing was to multiply my TimeOfDay variable by 60 then divide it back by 60 with divide(whole and remainder) -such a great function that I didn’t know about- to get the minutes and then store them in a variable.