High score entry text box prints back an infinite loop

Hey guys,

So I’ve added this high score entry text box to a widget my pinball game displays at the end of the game. You type in your name, it checks the save struct to see if your score is good enough to be in the top 5 high scores, and it prints out those high scores. Problem is, it seems to be printing those same 2-3 scores in an infinite loop. I’ve debugged and checked that the high score struct only has, say, two array elements if there have only been two entered names and corresponding scores, so I think I’m fairly sure it’s something to do with the UMG.

Here are some screenshots of the problem and some blueprints:

If these aren’t enough, I’ll upload a few more screenshots of the other blueprints that run after entering the name and might be the culprit.

Only think i can see it would looping is Output Text is not clear, like it’s not local, so try to clear it anyway. , you should use string here instead of text, text is for static text to be localizable and string is for storing text in general and can be processed, which is thing you doing.

I’m not sure but it might be because you’re nesting your FormatText calls.

Setting it to a local variable did it, thank you! But I don’t understand what difference it made, could you maybe elaborate what logic you followed? Because I’m sure the output text isn’t being accessed anywhere other than this blueprint.

No, that works fine, actually. I thought that was the problem at first as well since it’s a quick and dirty solution but it seems to work. Setting the output text to a local variable worked, however.

Text type is primerly made for localize text in other word static display text that does not change… and your text is clearly being heavily processed. the format node you using is generally used to paste variables to localized text. Not to mention format node of text is heavier process then just using Append in String as instead of searching for tags in text it will simply paste text together. So by best practice if you want to process the text you should use String and use Format only if you want to paste something to localized or display text.

In general you should also not do this in get function as it runs on every frame that displays the widget, so you reprocess the string over and over again on every frame which you can do elsewhere just once on every change.

Thank you for the explanation!

THIS comment here is what helped me. I couldnt figure out why it was calling this function a BILLION times.
“runs on every frame that displays the widget”, explains this entirely.
Where else could I create this logic, so that it only displays it once?