Multi-colored text string (UMG?)

I’m trying to build text strings with certain words colored differently in the middle of them. For example, the way N64 games used to be so fond of indicating relevant objects (“If only someone could help me find 3 GOLDEN TICKETS, I could get out of here!” with Golden Tickets in yellow) or how the Tony Hawk games would color special moves gold and gaps blue in your combo/move readout.

Now, I know that I COULD do this by breaking the text element into multiple text elements and adding the coloration to them individually… But the problem is, when trying to display text in UMG, using stuff like text assigned to line-wrap automatically inside a single canvas space requires a SINGLE text variable, rather than an arbitrary number.

So is there a way I can apply formatting to text variables? Or a way to combine multiple text variables for display in a single UMG text box in an arbitrary way (i.e. they scroll and line break as if they were a single text entry)?

There is in Slate, it’s called the SRichTextBlock, it’s an extremely complex widget compared to the others. Which is why it hasn’t been wrapped yet. You could make a very simple version yourself, just wrap it in a UWidget, and make the necessary decorator that supports the coloring you’re looking for, and just expose a text property that you can fill with your formatted text.

Now when you say “wrap it in a UWidget”, I hear “use C++”. Is that basically the gist of it?

Yup, that’s the gist.

I’m sorry to dig this up, but is it possible to do this from the UMG editor now, or is it still purely a C++ thing?

There’s an experimental and unfinished wrapper for SRichTextBlock in 4.8 that you need to unlock with C++.

Hi,

Sorry to dig this up but I’m seing that it is still experimental in 4.9. Any date when this will be released?
Is there any workaround until then?

Nope, it’s not on the priority list right now. There are some terrible workarounds I wont recommend. I’d recommend copying the relevant bits in 4.9 into your own C++ project removing the experimental flag and tweak it to get the support what you need. Out of the box it can do simple color changes.

Thanks for the feedback.

Is there a way for us to raise the community interest for this?

Until then, I may add a container with textblock in it to manage 1 color per message with a limit of 20/30 text to avoid performance drops.
I will also look at the experimental widget to see if it can meet my needs.

Do we have some status of what’s work / not work?
Does adding images is working?

Is something like this considered “a terrible method”?

Multiples text block in a wrap box. Of course supposed to be dynamically updated.

c406dcfccbc883f6691e4e5415a20410b2cb805e.jpeg

EDIT: Really not easy to manipulate actually =/

Real terrible, performance, matainability. All bad. Forget dynamically modifying it from an external data source.

I’ll try and get it usable in 4.12. If you have any C++ skills at all, using the SRichTextBlock is the best way, and making a dedicated wrapper for one isn’t that hard that works for your team. Making an extensible one is a pain, which is what’s holding up the one I want to make for UMG.

In the marketplace is a version which costs 10€, but I also made a cheap port from the SRichText to UMG. If you want, I can pack it into a plugin and put it for download, since you need to compile the engine from source or create a clone of the files yourself.

I decided to make it into a quick plugin so people can use it before Nick has officially finished it :slight_smile: (Hope thats ok): [Discontinued] UMG Rich Text Box - Released Projects - Unreal Engine Forums

Glad this is being addressed soon, and thanks for the plugin!

Any update? Will we have this anytime soon?

I’d also be very much interested in an update on this. When can official support be expected? It’s been requested for quite some time now, e.g.:

Thanks very much for explaining the possibilities so far!

Hey everyone, just to up this one, i’m very interested in this too :slight_smile:
Cheers
Cedric

What is the current state of rich text block?

I am using UE4.16.1 and can’t seem to find this widget in editor.

When will Epic officially support this widget?

Official rich text block would be great to see (even if we have to turn it on in experimental editor preferences). Just a +1 community interest from me.