Does a safed widget refernce need to be casted to its class first?

Hey guys,
im currently working on a inventory. Therefor i’m seting on creation / after the creation the map of the current items.
The problem occured is, that the map refernce set in the widget is always empty. The inventory class is a own blueprint with the map in it. The calling blueprint of the shown picture is the game hud. At the blueprint breakpoint i checked the variable and a value is in the map.

I tried to set the member directly on creation of the widget and as in the picture shown. As the event refresh item slots gets called in the widget the map is empty.

Does anyone have clues about that? Could the problem occur as a problem of the inventory class themself or are widgets nasty to me?

For anyone with constructive advices, you re welcome in advance :slight_smile:

I actually even tried to hand the object over as value of the event. Sadly the map still keeps empty.

Can you show the code for Refresh Item Slots?

I will post the picture of the event soon. Im actually not in range to get it. In around 6hours im able to post it.
The problem occurs pretty at the start of the event. Its the point i collect the keys of the map. I call an function on my inventory class which gets the map and then “Keys” of it. Already there the map is empty.

Just a suggestion, you can expose widget variables on spawn so they get initialized as early as possible, and also so you don’t forget to initialize them. There’s a switch in widget variable details panel…


It has to be Instance editable too of course. And then you get an input pin when creating the widget…

Sry to waste your time. I was just creating a good example to see the values difference as i noticed i forgot to link the member to my getter function. Ty for your help anyway :smiley: