Press widget button = start/stop skeletal animation. How?

Hi.

I have imported an animated .fbx into UE4 and everything seems to work fine. I have my Skeletal Mesh Actor (and a bp created from it) and its Animation Sequence. I have also created a Widget with a button, and here is where I haven’t been able to find a way to connect everything in a way that I can play and stop the animation when clicking/pressing that widget button. I have tried to cast that bp into the widget bp, used event dispatchers, etc… but nothing works and I don’t know what am I doing wrong (a lot of things for sure).

Any suggestions? Thanks!

Hello again.

I solved my own problem, and I’d like to share the solution in case everybody who faces the problem has a place to look at. The way I achieved it was with Even Dispatchers (I was using them the wrong way at first, but gave it another try). An here is how I got it working:

  1. Configuring the widget BP: Just create a button, set it On Click/Pressed or whatever you need it to work with, create an Event Dispatcher, and connect both. That’s it.

218951-widgetbp.jpg

  1. Create an Actor BP, and inside it, add your Skeletal Mesh(es). In my case I wanted the animation to be playing at start, so in each of your Skeletal Meshes, select Animation Asset in the Animation Section, and load its Animation Sequence.

  2. Configure the BP so it will show the Widget where the button is.

  1. Create a variable of your Widget, place it as SET, and bind your previously created Event Dispatcher to it. Now create a Custom Event, link it to a Flip Flop Switch and chain your animations through the Override Animation Data node, configuring it as you wish or need. In my case:

And that’s it. Your widget button will play and stop the animation :slight_smile:

UPDATE: You can also substitute the Override Animation Data with Play and Stop nodes (make sure it’s for Skeletal Mesh Component, not Widget). This will stop the animation in a certain point and resume it from that point, which is even better for my needs.