How can I listen for an anim notify event on C++?

I have a montage with a custom notify and I have inherited the UAnimInstance to handle my animationBP from code, that being said I have access to the FAnimNotifyEvent but how do I declare a callback on C++? On the BP you just add a new “Anim notify event” and that’s it, how can I do the same on code?

P.D. I don’t want to add anything on my blueprint for this, how do I make the callback only on code side?. I think I could create a subclass of UAnimNotify (or UAnimNotifyState) and override their methods but then the callback implementation lacks the UAnimInstance’s variables I have, so far I can only think about exposing the method I want to call on C++ for my BP to call it whenever the notify fires.

If I understood the question correctly, this could help:

I encountered that same question before, he is adding a notify from code but he has an inherited class of UAnimNotifyState where all the events fired by the notify are handled, and as I pointed out I want to be able to create a callback on my UAnimInstance custom class (like you would usually do on a BP), if you know of a way to connect the event from the UAnimNotifyState to the UAnimInstance callback please let me know.

If you derive from AnimNotify, the first argument to the callback (Received_Notify) is USkeletalMeshComponent. You can get to your anim instance from there.

Oh really? didn’t notice that, thanks!
Edit: I just did some refactoring on my code and this totally worked, thanks again for your help :slight_smile: