Sharing the same AnimationBlueprint on several skeletons

I’ve got a complex Animation Graph set up for my player and i want to share the same states/transitions with my AI as their behavior are basically the same. The issue i’m facing is that they’re based on a totally different skeleton and i didn’t find the right way to share the AnimGraph in such case.

I already tried playing around with AnimationRetargeting, Duplicate AnimBlueprint and Retarget, i created a Blueprint based on my AnimInstance… but none of them are working.

The feature i need to implement is a specific AnimInstance that allow the Asset Override Editor to override the Skeleton asset the same way it allows to override the animation assets.

If anyone has found a way to do this it would be a great help.

Is there any way for you to use the same skeleton for the other characters?

If not, could you please describe what “not working” means in this case? I would think that re-targeting would work as long as the skeletons are somewhat similar.

Also, it sounds like you are just trying to share state transitions. If that’s correct it may be easier just to abstract the logic in the transitions into the pawn (assuming it’s shared) and rebuild the states for each character.

If that’s not an option, another one may be to see if you can create a parent anim bp that has the states in them and then create subclasses of that for the actual implementations (this will only really be logical if you have different animations but the same state logic).

Another option would be to see if you can create an anim graph by itself and bring it into the the anim bp. This would likely need to be done in C++ as I don’t recall any of those options in the bps.

My player and the AI are not the same shape at all, let’s say my player is a Human and my AI are Centaur so re-targeting is not an option.

The animation team has already exported everything for both skeletons and everything matches by name (Walk, Run, Jump, Dash…), the logic in the AnimationBlueprint should be easily shared.

The main issue comes from the Play Animation and Time remaining nodes that references the assets directly even if we check the animation sequence to be set by a pin and make specific code to match our skeletons.

maybe instead of accessing the assets directly you store them in a var on the anim bp and on begin play in the various pawns you get the anim and set the var in the anim bp.

Or, just set the anims as a public var on the pawn and get the pawn in the anim bp and feed that to the Play Animation node? For this you may need to add another layer of indirection above the pawns if you have more than one type without one common parent but that should be easy.

Hi, I already created my own AnimationInstance in C++ with a specific function that allow me to get the animation asset by name so the “genericity” should already be working but as i said in my last comment Play Animation and Time remaining still references the asset it was pointing at when created whatever i link to their sequence pin :frowning:

Got an answer from Epic staff :

You can share the skeleton as long as
they share same hierarchy

So i can’t share my AnimGraphs as my skeletons are highly different.

I have found a fix for this! The problem is literally that UE4 will not populate animation overrides with assets from other skeletons, but you can force it to use them!

Steps are as follows:

  1. Create a “master” animgraph where all your real interactions will be kept.
  2. Create a child animgraph off of this with the same exact skeleton.
  3. Create a retarget copy this child to your new skeleton.
  4. Duplicate animations from your original skeleton (doesn’t matter what they are, they are going to be replaced).
  5. Plug in those duplicate animations into the overrides on your new skeleton.
  6. Force delete each duplicate anim by hand, and on the delete popup, “replace references” on the dup anim with the animation from the skeleton you would actually like to use.
  7. Repeat for every single animation you have.

The only problem is that the override dropdown won’t show assets from other skeletons, or let you manually type in the anim name. Hope this helps!

does this work for blendspaces as well? I tried this method and retargeted the idlewalkrun blendspace, but it didn’t work.

Maybe i am doing something wrong in step 5 - could you explain what you mean by overrides here? I just retargeted all the anims, and when i opened the skeleton, all the retargeted anims were listed, I didn’;t see any place to “override”?

thanks

Hey, yes it does work with blendspaces! So one important step I found out as of late is you need to force UE to recompile the anim graphs even though it will show a green check mark. Hit the drop down next to the compile button near the top of the screen and select “always save on compile”, then hit compile and save. If you already compiled before setting this option you have to close and reopen UE4, or it will never save the compile edits and you’ll be very confused for many hours (like me).

If you create a child anim graph it will have a section that says “overrides” with all the assets that are used in the parent anim graph. This way you have one actual anim graph to update, but infinite types of characters with unique looking animations. Using retargetting only works if all your characters move the same way, and also forces everything to get generified a bit.

Hope this helps! I’ll probably post screenshots for this at some point. It doesn’t seem that Epic believes this is an important fix to make currently.