The basic Logic is correct. Make sure that all refferences are Set and all data is avaivable. Use Breakpoints or Print string to check.
The other thing you should try is to expose the ItemData at Spawn and plug it in directly as you create the Button Widget. Just to make sure the Data is avaivable when your Buttons Constuction Event runs.Right now it runs the Construction Event first and than sets the Data.
If you dont find a Solution please also add a screenshot from your Button BP.
And last note: the dynamic buttons will not show up in the designer! Only in Game. Dont forget to Add your Main widget to the Viewport.
I’m trying to add dynamic buttons to a inventory system and it seems things have changed in 4.11 and later. I’ve followed a couple of tutorials and have also done a search on how to get it to work. The plan is to do a list of buttons in a scrollbox but they don’t seem to be showing in the inventory. both blendertech and Invicta studios do the same type of inventory list process but I can’t seem to get the buttons to show. here is the pic of widget blueprint
I added printstring on pickup in mycharacter blueprint. It prints it to the screen no problems. that was done even before starting the UMG. also all variables are all public. here is screenshots
When ever I pick the item up and printstring in mycharacter, it prints no problem. but from my understanding the way the inventory is set up is, it casts to mycharacter, get inventory, on pickup add item data, foreachloop add button and add button to scrollbox as child. But it seems it doesn’t add button to scrollbox as child.
I found the problem. it needed a casttomycharacter not a variable with a variable type Mycharacter.
Ok but you never told your Widget to Update if you Pick something up. You just send over whatever there is in your Inventory when you create it. I did not See any Function that Updates your List unless you completly Destroy and recreate the Main Widget nothing will happen if you add items to your Inventory (making the Widget invisible is not enough!)
So do you recreate or Update it in any way? If not it will not Update on its own (adding more Button Widgets)
Ahh just saw your Update. So yeah you did not have a valid Character reference (thats what I asked you to check ;P) you can do it this way like you got it now or you can take your Variable and Expose on Spawn and pass your Character along (what I thought you done here btw!) like this:
Thanks for your help Nachtmahr