Announcement

Collapse
No announcement yet.

Widget Text Doesnt change when its in an array

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    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:
    Click image for larger version

Name:	_1.PNG
Views:	1
Size:	134.7 KB
ID:	1205337
    Here is where I call it:
    Click image for larger version

Name:	_2.PNG
Views:	1
Size:	84.3 KB
ID:	1205339

    #2
    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.

    Click image for larger version

Name:	DebugTextHelp1.png
Views:	1
Size:	112.8 KB
ID:	1121215

    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:

    Click image for larger version

Name:	DebugTextHelp2.png
Views:	1
Size:	71.7 KB
ID:	1121216

    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.


    Click image for larger version

Name:	DebugTextHelp4.png
Views:	1
Size:	27.5 KB
ID:	1121218


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

    Click image for larger version

Name:	DebugTextHelp3.png
Views:	1
Size:	140.8 KB
ID:	1121217


    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.

    Click image for larger version

Name:	DebugTextHelp5.png
Views:	1
Size:	140.3 KB
ID:	1121219


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

    Click image for larger version

Name:	DebugTextHelp6.png
Views:	1
Size:	72.6 KB
ID:	1121220




    Docs: https://docs.unrealengine.com/latest...eatingWidgets/

    I hope all of this information helps.

    Make it a great day

    Comment

    Working...
    X