I am trying to play my reload animation from c++ when the reload bind is pressed, Here is the function that is called when the key is pressed:
void AMainCharacter::Reload()
{
UAnimInstance *AnimInstance = FP_Gun->GetAnimInstance();
if(AnimInstance!=NULL)
{
UE_LOG(LogTemp, Warning, TEXT("Reload"));
AnimInstance->Montage_Play(ReloadMontage,1.f);
}
}
I know the function is being called correctly because I get the output message in the log. Furthermore, I have also set the animation montage on my character blueprint correctly. Here is the screenshot from that.
After all this, the animation is still not played. The code compiles and runs as well (no errors).