RealDocs

UAnimInstance::Montage_GetEffectivePlayRate

function Engine Blueprint Since 4.14
#include "Animation/AnimInstance.h"
Access: public Specifiers: ENGINE_APIconstBlueprintPureUFUNCTION

Description

Returns the actual playback speed of the montage as seen in-game, incorporating both the instance play rate and the montage asset's RateScale. Prefer this over Montage_GetPlayRate when you need the real animation velocity.

Caveats & Gotchas

  • If the montage asset's RateScale is 1.0, this returns the same value as Montage_GetPlayRate. The difference only matters when the asset was authored with a non-default RateScale.
  • Returns 0 if the montage is not active. For use with root motion calculations, ensure you also account for the character's movement component scale.

Signature

ENGINE_API float Montage_GetEffectivePlayRate(const UAnimMontage* Montage) const;

Parameters

Name Type Description Default
Montage const UAnimMontage* The montage to query. If NULL, returns the effective play rate of any active montage.

Return Type

float

Example

Scale audio pitch to match animation speed C++
float EffectiveRate = AnimInstance->Montage_GetEffectivePlayRate(AttackMontage);
if (SwingAudioComponent && EffectiveRate > 0.f)
{
	SwingAudioComponent->SetPitchMultiplier(EffectiveRate);
}

Version History

Introduced in: 4.14

Version Status Notes
5.6 stable

Feedback

Was this helpful?

Suggest an edit

Select a field above to begin editing.