UAnimInstance::GetLinkedAnimLayerInstanceByGroup
#include "Animation/AnimInstance.h"
Access: public
Specifiers: UFUNCTIONBlueprintPureconst
Description
Returns the linked anim instance that is currently running for the specified layer group. When multiple layers share a group, all of them run in this single shared instance.
Caveats & Gotchas
- • Returns nullptr if no layer with that group name is currently linked. Always null-check before use.
- • For ungrouped layers (group name == NAME_None), each layer node has its own instance — use GetLinkedAnimLayerInstancesByGroup with NAME_None to enumerate them all, as this function will only return the first one found.
Signature
ENGINE_API UAnimInstance* GetLinkedAnimLayerInstanceByGroup(FName InGroup) const; Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| InGroup | FName | The group name of the linked layer to retrieve. | — |
Return Type
UAnimInstance* Example
Reading state from a linked layer group instance C++
if (UAnimInstance* WeaponInst = GetLinkedAnimLayerInstanceByGroup(FName("WeaponGroup")))
{
if (UWeaponAnimInstance* WeaponAnim = Cast<UWeaponAnimInstance>(WeaponInst))
{
WeaponAnim->SetAimOffset(CurrentAimOffset);
}
} See Also
Tags
Version History
Introduced in: 4.24
| Version | Status | Notes |
|---|---|---|
| 5.6 | stable | — |
Feedback
Was this helpful?