UAnimInstance::MontageSync_Follow
#include "Animation/AnimInstance.h"
Access: public
Specifiers: ENGINE_APIBlueprintCallableUFUNCTION
Description
Synchronizes a follower montage on this instance to track the position and play rate of a leader montage on another (or the same) anim instance. Used to keep two characters' animations locked in step.
Caveats & Gotchas
- • Both montages must already be playing before calling this function. The sync relationship is not automatically established at montage start — you must call MontageSync_Follow after both Montage_Play calls have been issued.
- • This is a one-way link: the follower tracks the leader, but not vice versa. If the leader stops or the OtherAnimInstance is destroyed, the follower continues playing independently.
Signature
ENGINE_API void MontageSync_Follow(const UAnimMontage* MontageFollower, const UAnimInstance* OtherAnimInstance, const UAnimMontage* MontageLeader); Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| MontageFollower | const UAnimMontage* | The montage on this anim instance that will be driven by the leader. | — |
| OtherAnimInstance | const UAnimInstance* | The anim instance that owns the leader montage. Can be set to self. | — |
| MontageLeader | const UAnimMontage* | The montage on OtherAnimInstance whose position and rate will be mirrored. | — |
Return Type
void Example
Sync a companion NPC montage to the player C++
// Both montages must be playing before syncing
PlayerAnimInst->Montage_Play(PlayerDuetMontage);
NPCAnimInst->Montage_Play(NPCDuetMontage);
// Lock NPC montage to follow player montage
NPCAnimInst->MontageSync_Follow(NPCDuetMontage, PlayerAnimInst, PlayerDuetMontage); Tags
Version History
Introduced in: 4.22
| Version | Status | Notes |
|---|---|---|
| 5.6 | stable | — |
Feedback
Was this helpful?