Need help with "Set members in struct". Cant get it to work.

Im trying to make a weapon upgrade. Each unique item is a struct called itemdetails. All the details from the item is in this struct. Now I want to change the struct for the item that is getting upgraded. So I made this little code for the button clicked event. Everything works yay! It gets changed and everything looks good. buuuut,

](Screenshot - 231607a00acb1b7a6b8bc08deb2dfe2d - Gyazo)

Its resetting everytime I close and open my widget. So its working but when I close the widget and open it again its getting back to what it was before I press the button (before its getting upgraded). Any clues? Anything would help! Thankyou for taking your time. Is this a bug?

Removing and recreating a widget will flush any changes you’ve made, so you should put the struct in some kind of blueprint (weapon/character). Also setting the struct after using set members is redundant.

You do not need to set ItemDetails after using Set Members, as it takes a reference, and already changes the variable. If you recreate the widget each time you open it, the value will be reset to whatever you set it to when you create the widget. Look into setting the external value that you are feeding into ItemDetails, rather than ItemDetails itself.

Ah I see, I feel pretty stupid now. Well, thankyou both for answearing. So I think I have to change the variables inside each upgradable item? I just thought setting it up in the widget would be easier. Or any other ideas?

The ItemDetails struct is a copy, so any changes made to it will not be made to the original. If your upgradeable item is an object, you could just change the value in the object, and then instead of having a copy of the values in your widget, just access the object’s values directly when you need them.

I see, thankyou for the answear. So what if i create a interface event in the masteritem. And call it from the upgrading widget. Is it possible to do it like this? Im getting class defaults from the item that is selected in my smithing widget. Then im printing the name as a string and this works. So should I change the structure (details) from here?

This is inside the MasterItem.

(Details are the name of the “S_Itemdetails” in master item. ItemDetails are the name of the “S_Itemdetails” in the upgrading widget. S_Itemdetails is the name of my structure.

sorry if there is bad english.