How to set actor int variable from button widget's OnClicked Event.
I have an actor which has a static mesh and widget component. Currently im dynamically adding button widgets to the widget component via a for loop. The ForLoop gives the button an index which also sets the column (uniform grid panel). I have set up a OnClicked Event where the button which prints out its index.
I am struggling to understand how to use the OnClick event and the index inside the widget blueprint to set a variable back in the actor which is an integer (meshIndex).
Do I have to set up a custom event inside the actor?
asked Aug 26 '15 at 08:13 AM in Blueprint Scripting
There are a couple different ways of handling it.
You could just store a reference to the owner Actor inside of the widget. When the onclick is pressed, it just calls the function directly from the stored reference. That seems to be the simpliest way of doing it.
Hope that helps.=)
answered Aug 26 '15 at 12:18 PM
So I worked it out, I just had to add another int variable in the event graph with another OnClick event referencing the button. Thanks Devero, the function also helped with the process :)
answered Aug 27 '15 at 12:35 AM
Follow this question
Once you sign in you will be able to subscribe for any updates here