Get anim notify state duration in Blueprint

Hey everyone,
Is there way when starting to call a custom notify state, to get the duration of this notify ?
I need to trigger an event that starts when the notify state begin and ends when the notify state ends, and have things happen proportional to the notify time. I’m trying to create a QTE button that will always start when the notify is started and make a “fail” if the player presses in the first 70% of the event, good if in the next 20%, Perfect in the last 10%.

Basically I need to get the Anim Notify State duration value into a blueprint and I can’t find a way to do it.

Hi,

Actually, you can get the start time but not the duration from the anim notify event with Blueprint in Editor.

However, you can create a C++ function in your BlueprintFunctionLibrary that will allow you to call it in Blueprint:

In you header file:

UFUNCTION(BlueprintPure, Category = "YourProject|Animation")
        static float GetAnimNotifyEventDuration(const FAnimNotifyEvent& NotifyEvent);

In you cpp file :

float YourClass::GetAnimNotifyEventDuration(const FAnimNotifyEvent& NotifyEvent)
{
    return NotifyEvent.GetDuration();
}

The result in blueprint :

319041-capture.png

Maybe this will be integrate by default in next engine version, but in wait ^^

1 Like

This is now implemented in the engine since 5.1. ANS “duration” returns the ANS’s duration, not the one of the animation.

I found a way in 4.25 to get a notify state duration. You want to Override the function Received_NotifyBegin in your custom notify state, and it comes with a pin “Total Duration” as soon as the notify state triggers.

You will find that it’s a bit tough to communicate the owner’s blueprint(at least on my end it was) my Cast couldn’t work in this particular blueprint. I had to create a Blueprint Interface, make sure my receiver had the BPI installed, and then message it through the BPI.