Tooltip Rich Text Decorator

Hi all,

I have a requirement that should be fairly straightforward but tackling it has proven difficult.

In my game I will have some text that, for example, look like this

“Hello there, welcome to {PlaceName}”

I want {PlaceName} to be replaced with a variable from a stringtable at runtime, and the user can mouse over that world, but only that word, to get a tooltip that gives them a definition.

I sort of got this working by making a special tooltip text widget, but I need it to be inline so that I can get wrapping working seamlessly on big dialogue boxes.

My understanding from Advanced Text Styling with Rich Text Block - Unreal Engine is that the ideal way to achieve this is with a RichTextBlock and a custom decorator. If anyone has any experience or other suggestions on how to achieve this I would be greatly thankful!

I suppose more succinctly the question is, how does one derive the decorator to allow the ability to inline widgets in a rich text block. It is remarkably difficult to find examples of the decorator in use!

Did you ever figure it out?

Sorry for the bump, but I’m curious if anyone knows how to do this. It’s something that CRPGs are doing, like Pillars of Eternity and Tyranny, and it seems like a good way of giving more information during dialogue without needing to shoehorn definitions and background info into the dialogue itself.

I was playing a 4x game and saw something like this and thought to myself “I wonder how they did that?” This post was one of the first search results I came across. 10+ hours later, I found the answer. I should have found it so much quicker, but accidentally went right by it when I first came across it.

I had read the UE post on the topic “Advanced Text Styling with Rich Text Block” towards the beginning of my journey but I was totally lost and didn’t even realize it held the answer until after I studied the code in the sample above. A huge thank you to Nauja!!

I hope this helps the next wayward dev that finds their way to this post. Good luck!

1 Like

Can please anyone elaborate on how to show custom blueprint widget tooltip instead of simple textbox? Tooltip widget is a simple border with a textblock. The actual widget class could be set in BP via UPROPERTY the same way as TextStyle and TooltipTextStyle in the sample project mentioned above.

Sorry for necro but I was looking for this too.
I need to display inline with text some widgets that shows key mapping and images.

Images is good using the provided Rich Text Image Decorator, but I was stuck at creating my own decorator. Was thinking about working my way from the rich text image decorator but a quick glance at the code had me search a little bit more for any online example lol.

I found this:

Code is provided. I will have a look soon but I am sure this can help others looking for this.

Best!
Turk

1 Like

One thing that all solutions to this problem have in common, including all of the ones posted here, is that the custom text decorator you write does NOT respect word wrapping in the rich text block it’s in:

In the example by Nauja posted above, I tried setting AutoWrap to true with no success:

Does anyone have a workaround or better solution? I tried wrapping every single word in the tooltipped text with its own <tooltip> tag, but that didn’t do anything to fix the wrapping.

Why is rich text functionality in Unreal so lackluster? It seems nearly impossible to implement a simple functionality of displaying a custom widget when hovering over rich text… (with wrapping that actually works).