UAnimInstance::UnlinkAnimClassLayers
#include "Animation/AnimInstance.h"
Access: public
Specifiers: UFUNCTIONBlueprintCallablevirtual
Description
Removes all layer links established by the specified class and resets each affected Anim Layer node to its default implementation. Call this when unequipping a weapon or deactivating a character state whose animation layers are no longer relevant.
Caveats & Gotchas
- • Passing nullptr does nothing — to reset all layers regardless of class, you must call LinkAnimClassLayers(nullptr) instead.
- • If InClass was not previously linked via LinkAnimClassLayers, this call is a no-op. It will not remove layers linked by a different class that happen to implement the same layer interface.
Signature
ENGINE_API virtual void UnlinkAnimClassLayers(TSubclassOf<UAnimInstance> InClass); Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| InClass | TSubclassOf<UAnimInstance> | The anim instance class whose linked layers should be removed and reset to defaults. | — |
Return Type
void Example
Removing rifle layers on weapon unequip C++
void AMyCharacter::UnequipWeapon(TSubclassOf<UAnimInstance> WeaponAnimClass)
{
if (UAnimInstance* AnimInst = GetMesh()->GetAnimInstance())
{
AnimInst->UnlinkAnimClassLayers(WeaponAnimClass);
}
} Tags
Version History
Introduced in: 4.24
| Version | Status | Notes |
|---|---|---|
| 5.6 | stable | — |
Feedback
Was this helpful?