Can't change text in widget. Using for-loop in Array of text objects.

Hello,
I am trying to create Skip Level functionality.
When you select a button and click Skip Level, buttons text is added to Array (Map in the screen shots) that is in Save Game BP.
Text of the buton is changet to Skipped.

Then, when you close game and come back (or just reopen the LVL selection menu), I want the Skipped levels keep saying Skipped, so I:

  • in the Event Construct, get the array from the savegame with skipped levels
  • try to change their text to Skipped

But with this, an error returns, that it is referencing None

So I am trying to check, if there is something in the Array/Map and the objects are there. Print prints what I want, set text says nothing is in the Array.

I have a Button, that has a Text inside. I set the Text as a variable and I add that variable to the array.

I tried it with Array, and now with Map, the result is the same.

Can anybody help me, please?

1 Like

I didn’t look too closely, but I think your problem is you are storing references. Next time you create the widget, the references will all be different.

You might have more luck with a map of level names → bool. When you reconstruct the widget, if the text ( of the button ) is in the map, the level is marked as skipped.

You were right, I was trying to store references, not having any idea, that they change with reload…

So I stored the text of button and with a reload compared the text with array of all button’s texts. When equal, mark as skipped.

Bro, I am trying to figure this out from lunch, and its 8 pm here. Thanks… a lot for the insight.

1 Like

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