Hi, I’ve been trying to reproduce your issue without success. I created an animation controller and some animations. I attached a StateMachineBehaviour to one of the animations with code in OnStateExit & OnStateEnter. Both behave for me exactly as expected. Each is fired once per machine per transition. The NetworkAnimator itself doesn’t invoke these functions; they are triggered by the animation. I even tried to force an animation to play twice, but the controller guards against that.
Can I assume from your code that you are seeing the firing happening twice on the server?
Life got busy, so my project was put on pause for a bit. I apologize for not responding. I am still getting this behavior in pre6. I would love to help you reproduce this. If you would like, you can DM me with a meeting or discord invite and I can screenshare to demo this issue with you. Visually, it appears as if it is causing the OnStateExit to also be called on OnStateEnter
I have the same issue with netcode 1.8.0, client authority mode, network animator.
The host mode,the host works fine,
this problem occurs on both host and server mode, and only the client side,
when client side plays the shot animation, the state behavior will execute twice on server
the animator.setBool is executed when networkvariable changed
for example.
I started an server(not host) and a client.
then attack,
then client: once → once → once
the server: once-> once → twice
Input.getMBD ->Animator.SetBool ->StateBehavior::OnStateEntered
Animations on the host are going into the StateMachineBehaviour’s OnStateEnter function twice.
First, I run animator.Play(“animation name”). Then, the animator state’s OnStateEnter function runs as expected. Then, the second execution happens approximately 0.2s after, seemingly for no reason.
This is pretty annoying, as it causes some particularly fast animations to start for a frame or two, and then it goes back to the beginning of the animation and runs normally from there.
This issue happens only on the host, and I’m sure it’s related to the NetworkAnimator specifically because if I take it out from the object, the issue stops happening.