How UI button works with any class blueprint

Hi I am creating an interactive module. I have a class blueprint in which i have controlled the rotation and movement of the static mesh by clicking left and right click. I want to control this via a screen button created in widget blueprint. How can I do this?

Hi,

What parts are you exactly having problems with? If you have managed to transform your mesh using the mouse buttons, implementing the same with UMG Buttons shouldn’t be much harder. You will need to acquire a reference to your ‘transform’ Blueprint class in your Widget class. There are several possible ways to do this, but I usually keep these kinds of references in my Player Controller, so by casting to it from your widget blueprint you could easily get the needed reference.

Once you have the reference, you can communicate with that class from your widget. Using pretty much the same logic that you have used with the ‘mouse button setup’, you can implement the same with a widget button (when it is pressed, the mesh rotates).