I want to add text widgets to my widget at Runtime

Hi, I am making a game with Towers, they can have multiple weapons with each its own Power/Type/Range. And I started to design the information UI when you click on a tower.

It looks like this at the moment :

Since they can have multiple weapons I want to be able to add texts widgets for each of the weapons depending of the tower selected.

How can I add Texts Widgets at runtime please ?

  • either wrap a text block in a user widget and expose a text variable on spawn:

  • or construct native text blocks:


Thanks a lot, the first solution worked for me.

Just to be sure, Since we create our own widget does this method works if I want to add another custom widget other than text ?

1 Like

Yes, it’s pretty much a standard way of working with UI. You use native widgets at the most granular level only. Most of the UI is made of wrapped widgets.

1 Like

Okay,thanks for your explanation :smile:

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.