Download

Widget Text Doesnt change when its in an array

So basically i placed a text in the middle of the screen on a widget.

what i do is, change that text in a another blueprint.Well if i simply make ‘Create widget’ and get a reference for that widget and say ‘set (variable name)’ it works, the text changes. but what i want to do is create a custom event in that widget and make 3 more texts on the screen and put all of them in an array(their value) and give the custom event an input for the index for that array and set the text that way,so I can specify which text I want to change the text of in anohter blueprint by just calling that custom event and giving it an index, but it simply doesnt work that way

Why is this happening? is there a workaround to this?

If anything is unclear let me know.

Here is the Implementation:
2107586dc93ebe7fcdafea5db8b0a5d5a6a0e29f.png
Here is where I call it:
bef082726a5545fe9d4410eb0c17cee15f2c02a6.png

Hey dogu189,

After taking a look at your post it sounds like you are trying to dynamically create and set text block in your widget. The first issue that I see is that you are using text variables. (I ran the setup that you have posted and everything updates as intended. I tested this by using a for each loop to print string all the text in the array.) I have provided an example of my test below.

589fde2aaaa85af141ea2c355548b4eab001cda0.png

If you would like to add text blocks dynamically at run time you will need to create a new widget with only a text block in it. This will be used as your custom text block. You will want to add this widget to the widget you are adding to the viewport (I have provided a link to some documentation that may help).

Text widget:

7d5c826d4dcadf9b0864d2111d5cd8e391f9d8fb.png

Add a binding to the text block and be sure to set the variable used to editable so that it can be changed outside of the blueprint that it lives in.

973dc6488c34714d4d428fdee27a885c4a655ae6.png

You will then want open the widget you will be adding to the viewport and make sure that you canvas panel is a variable.

DebugTextHelp3.png

In the example below I have added three text blocks to the canvas panel (I didn’t set the position for this example so the will stack on top of each other). After that I created a custom event that sets the text for the text block at the index specified to what ever is passed in.

87e869aabdcf7da0ea41e579751407bda4a0f668.png

Finally I added the widget that I wanted to the viewport and called the custom event that sets the text.

ef70a74f1f42b119da6c285c9ccc35f3aaef13eb.png

Docs: https://docs.unrealengine.com/latest/INT/Engine/UMG/UserGuide/CreatingWidgets/

I hope all of this information helps.

Make it a great day