UAnimInstance::LinkAnimClassLayers
#include "Animation/AnimInstance.h"
Access: public
Specifiers: UFUNCTIONBlueprintCallablevirtual
Description
Links all Anim Layer nodes implemented by the specified class, allocating one linked instance per group to share state. This is the primary runtime mechanism for swapping character animation layers (e.g. equipping different weapon animation sets).
Caveats & Gotchas
- • State sharing follows grouping rules: layers in the same named group share one instance (state is shared), while ungrouped (NAME_None) layers each get their own instance. Understand your layer groupings before designing shared-state logic.
- • Calling this replaces any previously linked class. If you need to blend between two layer sets, you must manage that transition manually — there is no built-in crossfade between layer classes.
Signature
ENGINE_API virtual void LinkAnimClassLayers(TSubclassOf<UAnimInstance> InClass); Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| InClass | TSubclassOf<UAnimInstance> | The anim instance class whose layer implementations should be linked. Pass null to reset all layers to defaults. | — |
Return Type
void Example
Linking rifle animation layers on weapon equip C++
void AMyCharacter::EquipWeapon(TSubclassOf<UAnimInstance> WeaponAnimClass)
{
if (UAnimInstance* AnimInst = GetMesh()->GetAnimInstance())
{
AnimInst->LinkAnimClassLayers(WeaponAnimClass);
}
} See Also
Tags
Version History
Introduced in: 4.24
| Version | Status | Notes |
|---|---|---|
| 5.6 | stable | — |
Feedback
Was this helpful?