Hello,
First thing i’ll say is sorry if i selected thw wrong section when asking but i thought it’s related to c++.
Well let me explain. I’d like to get some rich text features inside umg: like different colors in the same text or different font sizes, or even fonts. I found that some people already asked for this but got low importance (looks like people think this is an strange feature to have). This is a feature that almost every RPG have, at least the different colors in a text.
It can be used for importance terms such as Names, Items, Important Locations, etc and so on.
This said i’ve been messing around with what Michael Noland said me in the Extending The Editor Topic in the Forums:
Check out SRichTextBlock, which lets
you define different styles and
alternate between them in a text
string. There are a bunch of examples
in STestSuite.cpp
static FText GetAroundTheWorldIn80Days_Rainbow()
{
return FText::FromString(
TEXT("<Rainbow.Text.Red>\"</><Rainbow.Text.Orange>I</> <Rainbow.Text.Yellow>know</> <Rainbow.Text.Green>it;</> <Rainbow.Text.Blue>I</> <Rainbow.Text.Red>don't</> <Rainbow.Text.Orange>blame</> <Rainbow.Text.Yellow>you.</> <Rainbow.Text.Green>We</> <Rainbow.Text.Blue>start</> <Rainbow.Text.Red>for</> <Rainbow.Text.Orange>Dover</> <Rainbow.Text.Yellow>and</> <Rainbow.Text.Green>Calais</> <Rainbow.Text.Blue>in</> <Rainbow.Text.Red>ten</> <Rainbow.Text.Orange>minutes.</>\"")
TEXT("\n\n")
TEXT("<Rainbow.Text.Yellow>A</> <Rainbow.Text.Green>puzzled</> <Rainbow.Text.Blue>grin</> <Rainbow.Text.Red>overspread</> <Rainbow.Text.Orange>Passepartout's</> <Rainbow.Text.Yellow>round</> <Rainbow.Text.Green>face;</> <Rainbow.Text.Blue>clearly</> <Rainbow.Text.Red>he</> <Rainbow.Text.Orange>had</> <Rainbow.Text.Yellow>not</> <Rainbow.Text.Green>comprehended</> <Rainbow.Text.Blue>his</> <Rainbow.Text.Red>master.</>")
TEXT("\n\n")
...
SNew( SRichTextBlock)
.Text( RichTextHelper::GetAroundTheWorldIn80Days_Rainbow() )
.TextStyle( FTestStyle::Get(), "Rainbow.Text" )
.DecoratorStyleSet( &FTestStyle::Get() )
.WrapTextAt( 600 )
I’ve been trying to replicate what’s inside STestSuite.cpp in the Rainbow.Text part with no luck. Looks like my C++ skills are too bad yet to get on this level.
So What i’m asking is could anyone please tell me how can i add that kind of features to the UMG’s TextBlock? Let say i add the Textblock in a widget to show up some dialogue. The text could look like this:
“Hello, my name is Alan, bring me some Potion and I’ll tell you how you can go to the Capital.”
In this case just the word right beside the gets the color specified. Or rather:
“Hello, my name is Alan, bring me some Potion and I’ll tell you how you can go to the Capital.”
In this case everytime you set the color is changed for the rest of the text.
Is this possible at all? (In some other low-engines like RPGMaker or GameMaker this is really easy to achieve).
For me it looks strange after so much time noone did something like this even for the marketplace (i’d like to do it if i had the knowledge).
Thank you very much for your time and for your help in advance.