[Bug] Animation switch crash [Workaround - Feature Request]

We have a animation blueprint, with a upper body state machine.
We then have a Upper Body Animation which is an Animation Sequence. It feeds into a polay node and then into the Final Animation Pose.

Like this…

We set the upper body animation when the player attacks or finishes attack. E.g. in a AnimNotify.

If the new animation is shorter than the previous animation we get a crash.

  // Verify position assumptions
  check( bPlayingBackwards ? (CurrentPosition <= PreviousPosition) : (CurrentPosition >= PreviousPosition));

Is this a bug or is it impossible to set or change an animation during an AnimNotify?

Ok, I found a work around.
Instead of the upper body state machine having only one state, and switching the animatio of the state,
we have two states, A and B.
We then have a boolean as to which one is current, and use that to switch states.

Then our SwitchAnimationMovement function (blueprint) ping-pongs between the two. Thus when ever we change the animation we also shift state, causing a reset of the Play node in the Anim State.

Suggested Feature: When the Play node has the input pin enabled as to which Sequence it is, and the sequence changes, it should reset the playback frame index.

Some details of the workaround…

The upper body state machine…

The B state animation graph (A is almost the same.)

The Switch State code…

And the variables. UpperBodyAnimation is the desired animation sequence. the _A and _B versions are the actual set ones used in the state machine. The UpperPingPong is the flag as to which is current.

I have the same problem. This is probably the same bug, maybe it was fixed but it appeared again in newer version…
Unfortunately i can’t do the same workaround like you, because i have ~10 different animations that are picked randomly every time, HERE IS HOW IT LOOKS in my case - similar to your setup.

EDIT: I’ve just tested it and you are right, the bug appears only when the new animation is shorter than the previous one! Thanks for that observation, I hope Epic will fix this soon.

Hi Slavq,

In cases like this where your crash may have the same repro steps, we would appreciate it if you made one new answerhub post instead of reviving old posts. While the repro may be the same, the cause could be new. Please make a new post.

-.