Reusable Animation BluePrint
✍ Last Updated : December 13, 2022
🚪 Prequisite Knowledge (Optional)
Describe Initial Knowledge that reader need to know before reading this article
❓ Key Question / Problem / Issue
In a game, there may be characters that share the same animation logic but with different animation sets and skeleton rig. For example, player can choose male or female character, both have the same logic/movement but with different animation set and different skeletal rig.
✅ Expected Output/Definition of Done
Able to create different character with different animation sets using the same blueprint
🎁 Resulting Solution
Animation Blueprints can be defined as template which doesn’t have specific Skeleton and Animations assigned, but it can has animation logics (graph, blends and states) defined like regular Animation Blueprint.
Then other Animation BluePrints can be parented to the template AnimBP where they hold the animation clips to be played/used by the template AnimBP.
graph LR
MaleAnimBP --> AnimBPTemplate --> Player
FemaleAnimBP --> AnimBPTemplate
In the diagram above, MaleAnimBP and FemaleAnimBP are Animation Blueprints which are parented to the AnimBPTemplate, and hold the animation clips which will be used by the Player, while the AnimBPTemplate is where the animation logics are defined.
Defining the Animation Blueprint as template
First create an animation blueprint and select Template instead of Specific Skeleton
Then add blends and states in the animation graph as usual like in the regular animation blueprint. But instead of using specific animation clip assets, use blank sequence player instead.
Then select expose as pin in the detail tab
Link/promote Sequence Player input pin to blueprint variable
Using Animation Blueprint template
To (re)use the template animation blueprint above, create new AnimBP with AnimInstance set to the template above.
Assign the required animations in the detail tab
Then in the player’s blueprint in skeletal mesh component, assign the Animation Blueprint template (or any of its child class) to the Anim Class field. And use it like using any regular Animation Blueprint.
No Comments