I create a sort of clock timer for my game using a widget blueprint. I’ve got a 3 digit time (2:15 for example) with AM or PM following. The digits all update and display properly, but I for some reason the AM/PM does not. In fact it doesn’t even display.
If I remove the binding from the AM text, then it displays as it should, but with the binding, nothing is displayed. The “Time of Day” variable I created inside my game mode blueprint is set to AM by default but it still doesn’t display a value. Can’t figure out what I’ve missed. Aside from the fact that all the digits are integers and the AM or PM is text, there’s no difference between them.
Displaying text need string var, not text var, if i’m right … Try to convert it before set maybe ?
(All my texts are displayed with strings and localization works because of “Make literal Text” → Text to String)
Ok, so this is strange… I rethought the entire timer that I had made to see if there was something I missed. I deleted everything and came up with a different approach to making the time progress using a timeline instead of Event Tick. After re-designing, the AM/PM switch was still not happening.
Then I decided to delete the default value of the text variable and manually set the default value when the timer is activated (i.e. with a “Set” node) and THIS fixed the problem. So for whatever reason setting a default value for a text variable doesn’t seem to work. I’m using 4.10 so this may have been fixed already. When I’m able to upgrade the engine again, I’ll be sure to test it out and see if the problem still persists in the latest engine version.
Well the Widget converts whatever you input into a text parameter anyway which is why I decided to use a Text variable instead of a string. If you look at my screenshot above, you’ll see that there’s no conversion happening when I feed the Time of Day text into the return node. Unless there’s something I don’t understand about Text variables, it should work directly.
You can try to bind the text label to a string variable instead of a function, and set this var just after your “Time of Day” var … This is how I do and it works fine (if your new BP is close to the one posted !)
Well like I said, I actually got the text variable to work by setting the value inside the event graph rather than in the default value of the variable itself. For whatever reason this fixed the issue so as I said if it still persists when I nuke my OS in another 2 months (after the release of my game) then I’ll report it as a bug. It’s likely fixed though in 10.13
Thanks for the help though mdonge!