Download

need to change animation blueprint at runtime?

i’m making a game and i want to let the player to choose the hero that he want to use to play, in my blueprint i have used the “Set Skeletal Mesh” node to change the current skeletal mesh from the player character blueprint.

that part works fine, but i don’t find any node to change the animation blueprint, the main problem is that the two models that i have to use as the main player don’t have the same skeleton and i must change the animation blueprint to let the game animate the second model if the player choose it.

any idea how to change the animation blueprint at runtime ?

thanks in advance for all the help.

I’m not sure this will work with your set up but you can try using the Set Anim Instance Class node. That should allow you to set a new AnimBP.

thank you for your help Steve, it worked just fine !

I am having a very similar problem, and that node does not work for me.

Guys, I got a similar problem but the answer from this topic doesn’t work for my situation and i really struggled a lot to find this little piece of missing info…

So, everything like in the topic’s question BUT!

https://answers.unrealengine.com/storage/temp/88133-animbpswitch.png

On the picture above (and actually in the every single corner of the web) we got everything working fine, except one little thing - What if i want to set this Anim Class for a Set Anim Instance Node Dynamically???
I mean this dark blue/purple input of the Node.

I feel that it should be easy, you know… but… i really tried so many ways to set it, and all without a success.

My imaginary and perfect solution is:

Do all exactly same as on the picture but provide the reference to this input from the default variable of a BP actor class which is not spawned on a scene (i don’t want if possible to keep every single file on a scene just for reference purpose).

So my question is simple. How ?

Omg guys. After i created this post I switched into a really agressive mode of debugging and found very common mistake regarding the wrong initial data.
There are actualy tons of ways how to set this class. i realized that was trying to do the right stuff hundred of times, but i didn’t accept these as far as it wasn’t work for me.

So,** to assign it from variable, we need just to make a public variable of Anim Instance “Class” under desired BP. Assign the required AnimBP as default and use it via Get Class Defaults node as the input param for this Anim Instance Class node.**

Hope that it will be useful for someone as insurance that this is a working way.
Because i was struggling really a lot without confidence that it should be like this.

Why not just destroy the current player character, spawn the new character, with the correct anim instance already set, and posses it?

This should be a good reference for that…

Unreal Engine 4 - (Tutorial) Patreon Requested Making A Character Switching Stationhttps://youtube.com/watch?v=ziyKYTiOAdg
If you like what you learn in this video feel free to join my patreon page!
https://www.patreon.com/iamjohngalt75

Thank you so much bro!

Omg guys. After i created this post I switched into a really agressive mode of debugging and found very common mistake regarding the wrong initial data.
There are actualy tons of ways how to set this class. i realized that was trying to do the right stuff hundred of times, but i didn’t accept these as far as it wasn’t work for me.

So,** to assign it from variable, we need just to make a public variable of Anim Instance “Class” under desired BP. Assign the required AnimBP as default and use it via Get Class Defaults node as the input param for this Anim Instance Class node.**

Hope that it will be useful for someone as insurance that this is a working way.
Because i was struggling really a lot without confidence that it should be like this.
[/QUOTE]

  • Thank you so much bro!!