Hi All,
I have a mesh, and would like to bind a function in my class to its AnimInstance’s OnMontageEnded delegate.
e.g.
Arm->GetAnimInstance()->OnMontageEnded.Add(something)
For the life of me I cannot figure out what the “something” should be.
Hi All,
I have a mesh, and would like to bind a function in my class to its AnimInstance’s OnMontageEnded delegate.
e.g.
Arm->GetAnimInstance()->OnMontageEnded.Add(something)
For the life of me I cannot figure out what the “something” should be.
// Function declaration in header
void OnAnimationEnded(UAnimMontage* Montage, bool bInterrupted);
// In implementation
// Declare delegate
FOnMontageEnded EndDelegate;
// Bind it
EndDelegate.BindUObject(this, &UMyClass::OnAnimationEnded);
//Set it
MyAnimInstance->Montage_SetEndDelegate(EndDelegate);
Thanks very much for the reply dzeligman, I will try it out over the weekend and post back with results.
Awesome! Works like a charm. Thanks!
It really work!, thank you!
Fantastic! Remember to Set the EndDelegate after you play the Animation Montage! Caused me a bit of headache trying to find out what was wrong with my code, but I figured it out eventually. This post was a life-saver!
Same here.I too had a headache because of that, Is there any specific reason why the binding works only if it is binded after the montage is been played?Thanks