Hello,
No idea about widget solution as i have no more used umg since long but as work around, to find a better solution, i would set a box around widget (with widget as parent of box to have both moving or opposite) and use it for on clicked event.
I had this problem. I solved it the same way I solved the reinst issue.
I made a button and gave it a few variables. A string called “instructions,” a text for the button text, a texture 2d for the image, etc. On click, it sends an interface message to another passing “instructions.” That has a switch on string and depending on what the instructions are it carries out the button’s intended behaviour. Does that make sense? I’m not sure if I’ve explained that well enough, haha.
This way you can spawn a new button and give it its instructions on spawn.
hmmm, the answers of the other 2 guys here confusing me.
Am i right that you want the following:
During gameplay you spawn 3D Widgets when they should
each Widget will have different data stored
each widget has an OnClickEvent (set up in widgets blueprint)
when you(Controller/Character) click it you want to get the data of that widget
The problem is how does the receiver (you) get the information because you does not have any reference to that widget?
For kind of these purposes are Interfaces made. So when you click on that Widget it will do an Interface Call, after the OnClick event, and give the desired information of that blueprint as input parameters.
The Interface you have set up now then routes the information to the receiver which will handle those then.
If thats your problem and you dont know how to use interfaces i can show you.
If thats NOT your problem then sorry for disturbance
At least : On spawn, you can add it to an array “RefArray” and set an int “Ref” with index value in spawned bp. Then you can “get” it from array with the right index.
Based on initial blueprint : In spawned bp : an integer “Index” editable. In Level BP or where spawned is done : An array “SpawnedWidgets” with “Bp_Widget” as variable type and :
In your bp : index is the name of the integer variable.
In level bp : spawned bp variable type (selected in details) is the bp you spawn, your bp widget.