Updating Inline Image In RichTextBlock At Runtime?

Hello!
I’m trying to use RichTextBlock decorators to display input prompts (E.g. “Press [Gamepad Button]” prompts). As I’m mainly developing for PC, players will be able to use a gamepad or mouse and keyboard. As such, I’d like to have the prompt update depending on what device the player is using.

However, it doesn’t appear possible to change the ImageSet during runtime. Decorators appear to only be “fire-and-forget,” with no way to update, refresh, or recreate a specific decorator.

I could resort to just using a ton of WidgetSwitchers – one for every set of input glyphs – and flip between them at runtime based on the current gamepad, but that feels horribly inefficient.

I could try creating a special type of RichTextBlock subclass that could re-create decorators on command, but I’m not sure if that would be very efficient, either.

Does anyone have any suggestions on how to refresh decorators at runtime?
Thank you! :slight_smile:

I discovered that somewhere after UE4.25 (the version I’m using), Epic added the function URichTextBlock::RefreshTextLayout. I simply subclassed URichTextBlock and created that function, myself (which, like the version in UE5, just calls MyRichTextBlock->Refresh()).

Now, I can simply get the decorator instance, call a function on it to set the gamepad type, and then refresh the text layout to update the image accordingly.