Download

Animation state events

Is there a way I can have animation state events (entered state, left state) in C++?

I was able to get all states from the state machine like this and then I looped through the array to find the state I want by name:



TArray<FBakedAnimationState> states = animInstance->GetStateMachineInstanceFromName("Default")->GetMachineDescription()->States;


but I don’t know how to have an event…

In BP you can put the name of a custom event

img.png
These variables are inside [FONT=courier new]FBakedAnimationState as [FONT=courier new]int32 which seem to be the indexes of [FONT=courier new]FAnimNotifyEvents (that you can edit in the editor as in the print above) in [FONT=courier new]UAnimStateNode.

I think it is impossible to hook up a C++ method to this but it doesn’t hurt asking.

Thanks for any replies!

**EDIT: **looks like [FONT=courier new]GetMachineDescription() is protected, so I can’t use it. Ok, now I’ve lost all hope.