Animation Change Button

Hello, I’m looking to find what the blueprint node sets up so that when I press a button on the UI, my character does “animation[3]” from an animation array variable?

Thank you for your time!!!

Hello!

I’m not sure I understand you. Do you mean something like this?

Sure, sorry let me clarify - I have an animationSequence array of animations, and when the user clicks a button in the UI I want it to trigger the animation based on the current value of an index variable - Something like this:

Hope that clears things up!

1 Like

Yes, then I did understand your point.

You can set the array variable for each animation. Just pull off from the Array node and type in “GET” then press enter.

Unreal does this automatically, but you may not know who is assigned “0 + x”.

HOWEVER, it is better to use MONTAGES for this situation.

Also, make sure to respond directly, because I got no notification from you.

Awesome! I think that’s what I’m looking for, my only question is, how do I apply it to a specific Blueprint Actor? For example, I have a character blueprint called “BP_Character”, how to tell it to apply the animations to that character?

It depends on from where the animation is being called.

So, if the animation draw is WITHIN the Character’s blueprint, then all you need to do is pull the mesh to be animated into the workstation as a referenced variable.

If the draw is OUTSIDE of the character’s blueprint, then you need to get a reference to the character first, and then you will be able to instruct the draw to animate the mesh.

You WILL, however, have to make sure that the animation is compatible with the skeletal mesh asset or it will NOT play.

If you look at the image above you will see that the character’s SKELETAL MESH is inserted as the TARGET of the animation.

OK, so does this look right, if I’m trying to play the second animation in my array?
Your “Play Animation” node looks different from the one I found -

1 Like

It looks good, however why are you getting ALL_ACTORS_OF_CLASS? Just get ACTOR_OF_CLASS, unless you want the animation to play on multiple characters.

Don’t forget to set the index asset. Also, your PLAY_ANIMATION is targeted in a WIDGET, whereas mine is not, so the built-in functionality is different.

PS: Because it is NOT your character’s Blueprint, you’ll need to reference its mesh. Again, use GET_ACTOR_OF_CLASS, unless you want to apply this animation to multiple actors.


Ah, OK, so more like this then? I switched actors > actor, and I think that’s the right one now. Though, I’m still a bit confused about the “Play Animation” node, I get that mine is in a widget so it looks different, am I using the wrong one? Or what does the proper blueprint tree look like?

Widgets are generally created and destroyed, so you do not want to put any persistent data inside of one.

It’s usually better to make a blueprint that the widget will communicate with that has the logic inside of it.

I would, personally, not code for character animations to play in Widgets. I would create another blueprint OR use a preexisting one that the widget instructs to play the animation.

Yes, you code looks correct, but again, maybe place this code in a persistent blueprint. (Making sure that the blueprint is called first!)

OK, So in my case, this is just a Menu, and the character I want to animate is not and will never be playable, it’s just there so the player can see the customization.

Assuming, I did want to trigger the animation from here, is there no way to do with the setup I have so far?

Does it not work? Also, your asset query is empty.

You’re not showing me your work. I have no idea what you’re doing.

Sorry, let me record a video to show you what I have, and exactly what the status of the blueprint looks like -
OK, here’s a video showing my blueprint setup so far!

Thank you so much for your time!

Hey @TheRoyalSkies!

What you seem to be doing is adding to an array but not doing anything with it. You will need to cast to your character and then trigger the animation. Here is a crude example using the third person character’s built in jump function:

UnrealEditor_LLNgrTQlu2

I hope the above is the solution you need!

2 Likes

OK, the’s definitely what I’m looking for! My only question is, how does the blueprint node look like to “cast to my character”? This is exactly what I’m trying to do!

(Give it a few minutes to upload).

1 Like

Wow, that was a really awesome explanation, I’m trying to follow along now, and my only question is how did you populate your “Montage Array” with Unreal default mannequin animations? When I try to drag animations into it, they don’t seem to go in :frowning: But, thank you SO much for the help and video! Yeah, I’m totally new to Unreal, so I’m just following exactly what I see in the screenshots to get things to work right now. But, it is slowly starting to make more sense with help - Thank you!

Can you post another video showing me what you’re doing?

1 Like

Sure, I’ll post it later in the evening when I finish work!

1 Like

Actually, I got it too work!!! Slightly different method, but here is what the final set-up looked like!!!


Thank you guys so much for your time and patience, I REALLY appreciate it!!

2 Likes