I had a hard time implementing this. Incase anybody else is struggling – Here’s what I was trying to do and here’s the path I took.
I wanted a purely C++ way to control an AnimationMontage so that designers do not need to worry & so that my code is fairly modular. In my case a melee weapon is responsible for performing chain-attacks. My weapon is told to attack, and it gives its PawnOwner’s skeletal mesh an animation montage to do! So, I have a custom UAnimNotify that overrides the Notify(USkeletalMeshComponent* MeshComp, UAnimSequenceBase* Animation) method and within this method I use a delegate pattern to call some method in my Weapon, that way every weapon is responsible for handling its own chain attack! (aka, DECLARE_DYNAMIC_MULTICAST_DELEGATE pattern). I also have an FName on my custom UAnimNotify, editable from BP, so that I can tell which even occurred from my Weapon class.
Does this approach make sense? I’d really like to hear what others do. It’s a little bit annoying that I must AddDynamic link to each AnimNotify as a montage plays, and I wish I could make use of the AnimNotify_NOTIFYNAME – however I didn’t want to make a custom AnimInstance since I am in a Weapon Actor class and I think it’s appropriate for the weapon to manage all of its weapon based animations. Is this crazy? I’m not sure! Please give me some pointers! I want to learn how to manage the complexity of animations and decouple my code as much as possible.