Problem with getting data to Widget from GameInstance/Struct

Hello
I need to display character data in Widget, few characters, data stored in GameInstance/Struct.

This simple code works for update Text value, when struct value is changed, this is visible on widget. Simple bool - when true text is true when false - false:

But in other places, same rule, it fails. This is same widget, identical code, just other Widget Text.

Maybe I do something wrong, but I can’t find good tutorial how to get dynamic data from struct to widgets. My struct is list of arrays.

What exactly fails about it? Judging by what is shown, it seems that each widget has its own struct. If we change the data in a widget, that one widget will see it. Other widgets have their own struts with data remaining unchanged.


I need to display character data in Widget, few characters, data stored in GameInstance/Struct.

Perhaps that’s your problem - the struct you’re showing is not in the Game Instance. Instead, have the widget reach out to the game instance and fetch the data. Ideally, make it Event Based - ask the widgets to update only when needed. The functions your bind run every frame, all the time - pretty wasteful.

Character in Car - sounds like this should be updated only once someone gets in / out of a car.


This is same widget, identical code, just other Widget Text.

When you say same widget, you probably mean another instance of the same same widget class. Another instance would have its own instance of the data. This struct in 2 different widget is actually 2 different structs.

Thank for your reply and sorry for my bad problem explanation. I solved it, maybe not best way. For now I cast to game instance every time I get data from struct, on every text update and it works as should - for me. I will not drain it more, some rules I forgot, I not work in UE4 few years.

1 Like