How do i get the player character to do a animation

hi i want the player to press the button and an animation to play such as a sword swing etc not jumping or anything complicated

I would use an animation blueprint and blend spaces.

There are 2 ways:

  1. using play montage in AnimBP ( )
  2. Cast to player character in level BP (or character BP) and make node Play animation. It is difficult, because in the end of animation you should assign AnimBP class again ( )

As for me, for player character I recommend use layered animation and anim montage