Constant anim notify begin events when playing online

I’m reasonably certain that the issue we’re facing is this:

We make fairly heavy use of animation notifies and so the firing of them being unreliable is something of a major blocker. We are unlikely to have the option to upgrade to 5.8 in time for launch; is there a fix we can apply locally for this issue?

Steps to Reproduce
Create an animation blueprint

Add a montage slot

Create a gameplay ability which triggers an anim montage in that slot

In that montage put a timed notify

Simulate a networked game with multiple players

Trigger the anim montage via a locally predicted gameplay ability

Observe that notify begin fires every frame

Hey there,

Yes, most likely this is the same issue. The reason this happens is because of a function in the character movement component, UCharacterMovementComponent::MoveAutonomous. This function ticks the skeletal mesh animation while handling network corrections to handle when a correction happens while playing a montage. The issue is that UCharacterMovementComponent::MoveAutonomous doesn’t perform a complete update and evaluation of the anim instance which has a cascading effect to where the queue for notifies contains both start and end data on every frame.

I’ve attached a patch file that should help with the issue. Could you try it out and see if it helps? It copies UAnimInstance::ActiveAnimNotifyState before MoveAutonomous updates the anim instance, and reapplies it after the notifies have been dispatched. Between copying and re-applying, it also strips out any non-montage notifies from the anim instances’ ActiveAnimNotifyState buffer since MoveAutonomous only cares about notifies from montages.

Dustin

Got it,

We have an official fix in review right now, as soon as it is through review, I’ll make a patch file for you and link you to the CL as well.

Dustin

Hi Dustin,

Thanks for quick response. I gave it a go but I’m afraid I still seem to be seeing the event firing multiple times from the call:

OwnerMesh->ConditionallyDispatchQueuedAnimEvents();

within:

if (OwnerMesh->VisibilityBasedAnimTickOption <= EVisibilityBasedAnimTickOption::AlwaysTickPose && AnimInstance->NeedsUpdate())

which doesn’t seem to have been altered by the patch. That’s also inside a check on EnableQueuedAnimEventsOnServer which has the comment:

“Enabling this is recommended in projects using Listen Servers.” (which ours is)

Thank you, very much appreciated.

Alright, here’s a p4 patch file that you can try. This is also CL: 47265321 in mainline. Let me know if this helps you out.

Much appreciated. I did some quick testing with the patch applied and can confirm that Begin and End seem to only fire once per connected player.