I have several animation sequences with custom C++ AnimNotify classes hooked up. The classes only override Notify and the constructor (and call super anyway). When these animations are played through a Montage, the server will often not trigger the anim notify. The clients all trigger it fine.
If the server is a listen server and the host plays an animation, all the notifies will trigger, but just like in the dedicated server if a client’s character plays an animation more often than not the notify doesnt trigger on the server. This occurs in a fresh project, even if I directly select the montage by setting the character to “Use Animation Asset” in the defaults. As an aside, typically Im triggering these animations through the client, then sending them to the server for multicasting with logic to exempt the original client as it predicatively played. This behavior doesnt seem to occur when playing the animation directly through an Animation Sequence as opposed to a Montage, but then of course I lose networked Root Motion functionality. Placing the anim notifies in the Montage as opposed to the sequence doesnt fix the issue either. This project relies heavily on AnimNotifies and without the server consistently triggering them I cant maintain a fully authoritative server.
I already tried setting all sorts of variables related to replication. Is there anything Im missing or have I stumbled across an issue with the engine?
This is quite an old bug , I came across it a few years ago . Setting the trigger mode to Branching point instead of queued helps a bit , but its still very unrealiable.
I found a workaround to this, in fact is not 100% perfect, but works good enought for being playable (I think I’m getting results close to 90% or more, but also depends a little bit on the animation frames, more frames, the better reliability it gets to fire):
If you configure the notifys as AnimMontage Notifys, they will always fire on the server (not on clients) but from there you can make a multicast to all clients telling them that the notify fired and do your logics.
Also, you have to make sure that your character mesh is set up to “always tick” in the option “visibility based anim tick option”
I ran into this problem recently. Bumping to verify that the biggest problem was the VisibilityBasedAnimTickOption on the skeletal mesh.
I’m guessing dedicated servers don’t consider the mesh “visible”, so the tick option needs to be either AlwaysTickPose or OnlyTickMontagesWhenNotRendered, depending on whether you need serverside notifies in all anims or just anims played through montages.
Anim notifies seem to be quite buggy on dedicated servers.
The fix for me was to use AnimNotifyStates (which get triggered all the time on dedicated servers). Hopefully that helps someone.
Best practice is to handle AnimNotify only for Client for sounds etc. if the animnotify is used to states etc, better to code it and track through code using events etc.
you have already built-in Delegates for OnMontageBlendingout and ending for example :
here i used the OnMontageBlendingOut and i handle it through code for different situation for different animations
I ran into the same issue in UE4.27
What I’ve found out, that in ServerMove_PerformMovement, it does call the TickCharacterPose if root motion is running, but does not call DispatchQueue. So if there are 2 movement packs in one tick, events are eaten (because TickCharacterPose clears the queued notifies)
To remedy this, I’ve overridden ServerMove_PerformMovement in my own movement component, and called it, in case we are playing root motion.