How to play a character animation by clicking on a Widget button?

Hi, I’m new to Unreal Engine, I want to be able to click a button on my widget, which will play an animation on my character. How do I do that?

For this level, I have the widget spawn through the level blueprint. The widget has buttons, when you click a button it spawns a character, but I don’t know how to play the animation for the character when the button is clicked.

This is in my character blueprint, so far what I’ve got but the casting keeps failing:

  • make a widget with a button
  • create and add it to the viewport
  • bind the button’s onClick to an event
  • play the animation

How do I bind the button’s OnClick to an event?

On Begin Play:


More on Event Dispatchers:

1 Like

What if I created the widget in the level blueprint?

Generally speaking its not good practice to create the widget in the level blueprint unless you want the blueprint to be specific to that level and that level only. You can easily break references and have to redo all of the widgets from scratch when you do stuff like that in the level blueprint. Most of the time you create the widget in the actual character.

1 Like

Thank you for the helpful info! For this level, I have the widget spawn through the level blueprint. The widget has buttons, when you click a button it spawns a character, but I don’t know how to play the animation for the character when the button is clicked.

1 Like

I found another post that had the solution, thank you guys for helping me!

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.