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:
Here is where I call it:
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.
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).
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.
You will then want open the widget you will be adding to the viewport and make sure that you canvas panel is a variable.
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.
Finally I added the widget that I wanted to the viewport and called the custom event that sets the text.
Docs: Creating Widgets in Unreal Engine | Unreal Engine 5.0 Documentation
I hope all of this information helps.
Make it a great day