Blueprint: DrawText, Append, newline(\n)

Regarding this:

I’m not sure if newlines previously worked or whether he is referring to C++ and not Blueprint.

Is it (will it be) possible to append a newline to a string for multi-line textual display using DrawText?

Adding \n or even < b r >
to the Append node has no effect.

To be honest, i can’t answer your question directly. BUT i know, that the InfoTextBoxes (or what ever they are called) in the content_examples are using multiple lines. If i remember correctly, they are doing it with an array.

I also read something about multiline from slate, that is coming in 4.4. But i did not understand if its a BP feature, a c++/slate feature or an Editor feature.

Maybe someone else can provide more information. Thats all i got so far (:

You can put newlines in text render components by using <br> Not sure if it works for DrawText, but I would imagine so.

Can someone on the UE support-team comment?

Hi everyone,

Try a setup like this:

One of our development staff, Lauren, put this together. Until we have a more viable solution this should help get multi lines on your HUD.

Thanks /Lauren.

That works, and will use as an interim workaround

The only workaround I found to add newlines in BP, is by making a new variable. You can write an actual new line in its default value (Press enter), then use the variable.

Good call !
A very simple solution.

This was a great and simple solution in 4.5.
However, the newline method no longer works in 4.6

Staff, why was this capability removed?

It was a much simpler alternative to building an array of text, looping through the array and having to check the text height for display …just for a line break :frowning:

Hi ,

I just tested this and it seems to be working on my end, are you using a Receive Draw HUD event?

Hi ,

I am using a HUD but not sure what you mean by “using a Receive Draw HUD event”.

Basically,
If I run UE4.5 and create a string variable in a HUD I can add a newline character to its default value by pressing ENTER (the editbox expands to confirm the invisible newline character is there).

If I do the same thing in UE4.6 then pressing ENTER does nothing.

When you say it works for you - what procedure are you following and in what version of UE?

Hi ,

the specific node I am referring to is in the image above. It is an event called “event receive draw HUD”. I tried the exact setup in the image above in 4.6.1 and in 4.7 preview 4 and both seemed to work as intended.

Ah I see, That was my mistake! I was very confused when you said that it didn’t work and I thought you were specifically referring to the workaround I provided. Thank you for the clarification!

Ok, wires are definitely crossed :slight_smile:

That ForLoop setup is the workaround suggested by /Lauren and works perfectly fine as you pointed out, however that setup is not what I am referring to.
had a much much simpler solution of using a newline character in a string variable. This is what has stopped working in 4.6 (see his comment above mine and yours in this same thread).

No problem.

Can you find out from the devs why the feature was removed and if it will be back in another form in 4.7?

Hi ,

We have an internal discussion going on adding the feature for multi line functionality into text and strings. I don’t have a timeframe of when this will be made available, however it is being looked at by the development staff for future re-release.

Ok, thanks .

It’s a pity you can’t simply reinstate what was already there and working fine in 4.5, i.e. just press ENTER as the default value for a string variable.
That was basically ‘multiline functionality’ wherever you appended that newline variable.

Anyway, I have my workaround:

(1) In 4.5! create a HUD called BP_newline with a string variable called newline. The default value for this string variable is a newline character (press ENTER).

(2) Import BP_newline into my 4.6+ project, cast to access the newline variable (copy it to a local string variable if desired) and use it just like before.

It (at least) gets me back to 's simple append newline variable solution.

's a work-around for 4.7.

Add a new “Make Literal String” node. Put anything in the “Value” input.


Then select the node, and copy it (Either right click the node and select “Copy”, or press Ctrl+C).
Now open up any plain text editor (Notepad, Notepad++, etc.) and paste.

Then locate the random text you wrote.


Change that value to “\n”:


Now copy the whole text, and paste it into your blueprint.
You now have a “Make Literal String” node containing a new line.


Furthermore, if you want it to be a variable instead, after doing the above, right click the “Value” input pin and click “Promote to variable”, then compile the blueprint. This will create a new variable in the blueprint with a new line.

1 Like

Excellent post , yet another simple solution!

(I had no idea that could be done with blueprint.)

If didn’t know better I would think you were one of the ‘’ dev staff :wink:

You actually don’t need a make literal string node. You can also do this method with Build String’s suffix input. Not sure, but it may work with any string input on any node. I didn’t try it until I saw 's post , but it does work with different nodes.