Adding a new AnimNotify class
Unreal Engine offers a few stock notify types for things like playing audio or triggering particle effects from animation montages, but I’m assuming you need to run some custom C++ code at specific points in an animation. In that case, we can create a new notify type and use this to run any code we’d like.
- Tools > New C++ Class… and create a new C++ class with AnimNotify as its parent. Give it some time for the engine to be recompiled.
- Open up an animation montage and right-click a Notify track to add a new notify. The list should include your recently created custom notify class.
- Override the Notify() function in the newly created .h and .cpp files. Code should look something like below.
Save, recompile, reload, and when that animation montage plays it should now print the above message on screen.