Add new lines to a UMG text blocks

I’m making a simple chat menu that when someone types something and hits sends the text gets multicast to everyone and gets added to the text block. I can’t seem to get the text to show up on new lines. i tried to append /n
<br> in the blueprint and all that happens is the /n shows up in the text.

Anyway to make a new line with text blocks?

Thanks

is the way to do it in C++, though in blueprints all of those special characters have no effect currently. You could make a blueprint library in C++, i think we even have a new entry for it in 4.5 when you add new code, it’s just a collection of utility functions you’d want to be callable from Blueprints, but written in C++, you could make a GetNewLineText function that returns you the special text for a return.

What I would recommend instead is to not attempt to continue to append new text to an existing textblock. Instead I would recommend making a user widget containing a textblock as the root widget (remove the canvas), and generate a new instance of this user widget every time there’s a new message sent. Then you can just append these new widgets to a vertical box, or to a scrollbox…etc.

Thanks I did end up changing it to be an array of text that creates new text blocks. I did have a question about who “owns” the umg widget. I added a multicast replicated function to the widget to send the text but only the server gets the call. Do i need to move that logic into another object that the client owns like the player controller?

The UMG Widgets are client side only, and nothing on them is replicated. You can bind them to functions that sample replicated data to be displayed, but they themselves are not.

Does that mean it can’t contain replicated variables like arrays?

Correct, you should place that data on a replicated object instead and then give the UI a way to access that object so it can sniff new data. Also, you probably don’t want to try and replicate a whole array, you probably want to keep the arrays client side and only replicate the event that a new message was sent and what the message was.

Is there a tutorials that explains what each of the elements inside a UMG widget can do? I am really confused and cant figure out how this widget styling works. It is very different from all the other design tools i use

You should make a new thread for that question :slight_smile: