# How can I bind a function to AnimInstance-\>OnMontageEnd?

**URL:** <https://forums.unrealengine.com/t/how-can-i-bind-a-function-to-animinstance-onmontageend/290717>\
**Category:** Character & Animation\
**Tags:** unreal-engine, delegates, question\
**Created:** [August 11, 2014, 7:24pm UTC](https://forums.unrealengine.com/t/how-can-i-bind-a-function-to-animinstance-onmontageend/290717 "2014-08-11T19:24:54Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![staticvoidlol](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@staticvoidlol](https://forums.unrealengine.com/u/staticvoidlol)\
**Post date:** [August 11, 2014, 7:24pm UTC](https://forums.unrealengine.com/t/how-can-i-bind-a-function-to-animinstance-onmontageend/290717/1 "2014-08-11T19:24:54Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![anon26705860](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anon26705860](https://forums.unrealengine.com/u/anon26705860)\
**Post date:** [August 21, 2014, 10:27pm UTC](https://forums.unrealengine.com/t/how-can-i-bind-a-function-to-animinstance-onmontageend/290717/2 "2014-08-21T22:27:36Z")

</div>

// 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);

```

---

<div class="post-metadata">

**Author:** ![staticvoidlol](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@staticvoidlol](https://forums.unrealengine.com/u/staticvoidlol)\
**Post date:** [August 22, 2014, 10:04am UTC](https://forums.unrealengine.com/t/how-can-i-bind-a-function-to-animinstance-onmontageend/290717/3 "2014-08-22T10:04:23Z")

</div>

Thanks very much for the reply dzeligman, I will try it out over the weekend and post back with results.

---

<div class="post-metadata">

**Author:** ![staticvoidlol](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@staticvoidlol](https://forums.unrealengine.com/u/staticvoidlol)\
**Post date:** [August 22, 2014, 4:22pm UTC](https://forums.unrealengine.com/t/how-can-i-bind-a-function-to-animinstance-onmontageend/290717/4 "2014-08-22T16:22:38Z")

</div>

Awesome! Works like a charm. Thanks!

---

<div class="post-metadata">

**Author:** ![paul3k](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@paul3k](https://forums.unrealengine.com/u/paul3k)\
**Post date:** [December 2, 2017, 4:45pm UTC](https://forums.unrealengine.com/t/how-can-i-bind-a-function-to-animinstance-onmontageend/290717/5 "2017-12-02T16:45:02Z")

</div>

It really work!, thank you!

---

<div class="post-metadata">

**Author:** ![Lentzified](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Lentzified](https://forums.unrealengine.com/u/Lentzified)\
**Post date:** [July 26, 2019, 1:22pm UTC](https://forums.unrealengine.com/t/how-can-i-bind-a-function-to-animinstance-onmontageend/290717/6 "2019-07-26T13:22:14Z")

</div>

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!

---

<div class="post-metadata">

**Author:** ![Black\_Light0071](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Black\_Light0071](https://forums.unrealengine.com/u/Black_Light0071)\
**Post date:** [February 9, 2025, 2:40pm UTC](https://forums.unrealengine.com/t/how-can-i-bind-a-function-to-animinstance-onmontageend/290717/7 "2025-02-09T14:40:51Z")

</div>

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
