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.
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.
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?
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.
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.