Random Text Not Showing in Widget(UE5.4)

I’m trying to create a system where a ball passes through a specific location and a random event message is displayed. Once a message is shown, it should never appear again.

The random selection of messages works correctly, and duplicates are avoided as intended. However, the message is not being displayed on the screen. I suspect something is wrong, but I can’t figure out what.

Most of the logic is handled in the Game Instance.

I’m using two Widget Blueprints:

  • One contains only a Canvas Panel and a Text Block (for showing the message)
  • The other contains a Canvas Panel with a Vertical Box (for listing/displaying messages)

Could you help me understand what might be going wrong?

I’m using Unreal Engine 5.4.

Apologies for the mix of languages in the Blueprint.

Thank you in advance!

snippets


@kkun how you are displaying both of the widgets, like are you adding both of the widgets to viewport?

@alirizvi7861

Thank you for your question!

Regarding how I’m displaying the widgets:

My implementation displays the widgets as follows:

  1. WBP_MessageLog (the main container widget):
  • This widget is created once at game start (within the Event Init event of my Game Instance) and then added to the viewport using an Add to Viewport node.
  • This widget contains a Vertical Box (named MessageContainer) which serves as the container for messages.

  1. WBP_EventDisplay (the individual message display widget):
  • This widget is created whenever a new message needs to be displayed (within the ShowNextMessage event of my Game Instance).
  • After creation, this WBP_EventDisplay widget is added as a child to the MessageContainer (Vertical Box) within my WBP_MessageLog using an Add Child node.

So, only WBP_MessageLog is directly added to the viewport, and WBP_EventDisplay widgets are added hierarchically as children of WBP_MessageLog.

Is this approach incorrect?

@kkun so you can see on screen messages shown by print string?
I think there’s problem with your individual message widget.
try adding those manually as child in container with some text not at runtime but in your parent widget, just add 2, 3 and check if they are shown there, i think there’s alignment issue perhaps.