Widget isn't refreshing?

Every time I try to apply some changes to my widget blueprints, I have to reload it by removing and adding it again, otherwise it wouldn’t update in game…
For example when i try to add a new widget:

it doesn’t work!

Is this normal?

Not normal, show us or describe what changes and how you apply them.

Yea, you can update widgets without having to recreate them. There are a few different ways to update a widget. You can call specific functions on the widget from anywhere, and you can also “bind” certain elements of a widget to a function that constantly updates the variable assigned to it.

so here is e.g. the pickup section:

@ samnater:
how does that specific element updating work? thats exactly what i need :slight_smile:

It depends what you are trying to keep updated. Your code looks good here, but what exactly are you trying to update in your HUD? Is it a picture, visibility, an array of objects? I haven’t done updating for an entire inventory so I may not be able to help there. However, I would take a look at property binding here Property Binding for UMG in Unreal Engine | Unreal Engine 5.1 Documentation . You can use that to keep a widget constantly updated to whatever a variable is set to, whether that’s an image, score, life, etc. After reading that and getting a feel for it I would instead create functions that do something similar and update your widgets whenever you call the function. For example, in the details section of a part of your widget (lets say the score), you can promote that part of the widget to a variable. Then, after you update your score variable, call a function UpdateScore that sets the widget variable to the score variable. Using the property binding method is quick and easy by comparison, but it will constantly call the function which will probably be a waste of memory unless that variable is constantly changing.

Basically: promote a component of your widget to a variable. Make a function to set that variable to whatever other relevant variable you want, whenever that one is updated.

I hope this helps and makes sense!

I just want to activate a button in the same blueprint.
But this doesn’t work with my refresh method, cause then the boolean which sets it to active will be refreshed too… how annoying, lol.
Thanks for the reply - ill try it :slight_smile:

I have the same thing.

I don’t have to re-load it, but I have to press a button or something, and then the widget redraws.

How can I force the UI to update after add child?

This, apparently, it not enough:

EDIT: Apparently you can’t add children in the constructor of the widget! Some ■■■■ about it not being visible yet or something. :frowning:

Did you ever find a solution for this? I seem to have the exact same problem. I’m updating the text value of a text widget, and when I add it to my ListView using “Add Item”, the “preview” value of the text widget is what appears instead of the value I updated it to before adding it. By preview I mean the text value that you can set in the designer just to preview how it can look.

1 Like

I know its a old thread but I had the same sort of problem.

What I did wrong was implementing the wrong interface for my BP List Entry namely:
‘User List Entry’ instead of the ‘User Object List Entry’

After implementing/changing this I had used the 'Event On List Item Object" and casted the List Item Object to my own custom ListEntry so I could get the correct values:

I hope this helps anybody with the same issue.

I guess I have the same issue. Hope you will answer, where is the first screenshot from ? What BP ?

I fixed this by running “Force Layout Prepass” - invalidate doesn’t work, but the Force Layout Prepass after changing the list entry children causes everything to work just fine. Not sure why.

1 Like