Simple attack function not working properly

I have a simple BP to trigger my “attack”

What I do:

  1. In CharacterBP, On Input Event - Set Attacking to True
  2. In AnimBP, AnimGraph - if Attacking is True, play one of attacking animations (random sequence player)
  3. Each animation has AnimNotify that attack finished
  4. In AnimBP, EventGraph - on AnimNotify cast to CharacterBP to set Attacking to False
  5. When Attacking is False then attacking animation stops playing

Problem is that occasionaly my attacking animation is played twice or even three times (uncut) on one trigger.
It seems that Attacking variable is not being reset properly.
I thought that Casting from AnimBP is too slow and animation starts again, but then it should stop playing attacking animation right away.

Do you guys have any idea why this happens?

Are the AnimNotifies called everytime? Are the AnimNotifies a little back from the end of the animation and not exactly at the end?

Is there a way to check that the anim notifier is fired? Also the notify is always at least 2 frames before animation ends.

Use a print string.
Also, move the notify to the middle of the animation, just to see what happens.

seems like this is the problem of “random sequence player” node…

when I tried to play each of these animations separatedly there was no occurrence of multiple triggers.
when I tried to adjust parameters of animations inside of sequencer node I managed to reduce the number of multiple triggers. It’s strange, I have to look into this some more.