concatenate variables/strings for single HUD call

Hi all,

I have my HUD working with a string message. I want the total hud message to be a generic string, then a score readout, and then instructions to replay level. I would like to concatenate my strings with score variable from in game so I can do a single drawtext on the screen. Is there a way to do this?

As you can see from the image below (I know zoomed out, but specific words don’t matter in this case), my first word is in the comment box “Success Word”. This takes whatever term I choose for success, and centers it on screen. Below to the right I have a “Score” comment, where I again am determining the size of the score and then centering it, and pushing it down vertically.


It seems like I having to recalculate / rewire the same process over and over. I am coming from a web development background, and would just concatenate the strings and variables into a single output and display that.

Can I do this in Ue4? If not, is what I am doing (with separate drawtext sections for each textural component) the best practice workflow?

Thank you,

Use Append to add strings together.

Yes, this. Or try Build String. It’s practically the same thing, but I find it cleaner to use.

Ok - thank you - making progress. Now how can I append in line breaks if I wanted to separate the output into multiple lines on screen? I read somewhere that you can use CSS / html for styling the hud - can I add in an append which is a <br />, or a
for new line?

According to this answer on UE4 AnswerHub it is simply <br>. I am not not able to test it out at the moment, let me know it it works :slight_smile:

Nope, doesn’t work. I appended two variables with <br > (and <br />) at the end of variable 1 and it didn’t work. I also tried doing 2 appends, var 1 to <br >, and then this to variable 2, but the codes are just showing up on screen.

thanks for the input, I will keep plugging away.

Apperantly it works when you use Parse Into Array. Source: hereand here.

thank you, I will look into.

HI Moojamboo,

For a line break, the <br> does do a line break, to end the break you have to use </br> You can also use <div> </div> around each specific area to provide some spacing between specific divisions.

Note: I haven’t tried this in the editor, this is just my limited knowledge of scripting using this specific syntax.