# Animation state events

**URL:** <https://forums.unrealengine.com/t/animation-state-events/117736>\
**Category:** C++\
**Tags:** unreal-engine\
**Created:** [October 20, 2018, 7:02pm UTC](https://forums.unrealengine.com/t/animation-state-events/117736 "2018-10-20T19:02:37Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![anonymous\_user\_0ba2eb3c](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_0ba2eb3c](https://forums.unrealengine.com/u/anonymous_user_0ba2eb3c)\
**Post date:** [October 20, 2018, 7:02pm UTC](https://forums.unrealengine.com/t/animation-state-events/117736/1 "2018-10-20T19:02:37Z")

</div>

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:

```auto

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](https://d3kjluh73b9h9o.cloudfront.net/original/3X/c/4/c4985e165254e3da2f0fbd87f58ca1469c68e0b0.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.

---

<div class="post-metadata">

**Author:** ![rubm123](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/rubm123/32/476292_2.png) [@rubm123](https://forums.unrealengine.com/u/rubm123)\
**Post date:** [August 10, 2023, 2:37pm UTC](https://forums.unrealengine.com/t/animation-state-events/117736/2 "2023-08-10T14:37:58Z")

</div>

same question. I want to deal with these events in C++. My workaround implies to fill out the BP custom events for every single state

- “EnteredStateEvent”
- “LeftStateEvent”
- “FullyBlendedStateEvent”

In the even graph, I put the notes

- “AnimNotify\_EnteredStateEvent”
- “AnimNotify\_LeftStateEvent”
- “AnimNotify\_FullyBlendedStateEvent”

and then I connect every one of these nodes to a blueprint-callable UFunction, implemented in C++, e.g.

- “HandleEnteredStateEvent”
- “HandleLeftStateEvent”
- “HandleFullyBlendedStateEvent”

The first step is the really annoying part. I would like to provide my own Anim State Machine state node to take care of this.
