-
Notifications
You must be signed in to change notification settings - Fork 457
Description
Description
This occurs with the host player in the game, it is likely that the clients are affected but would like to solve it for the host first as I'm assuming it will also resolve any client issues.
It seems as if NetworkAnimator is overwriting changes made by my mob script:
animator.SetFloat("velocity", 0f);
For context, I'm setting animator.SetFloat on the host/server side in Fixed Update loop.
For some reasons NetworkAnimator overwrites the above line of code / SetFloat(); sometimes which causes my mobs to have their animation parameter "velocity" value to hold it's previous non-0 value, and visually it makes the mobs remain in their "walking" animation state while they are in their Idle behavior state (gameobject not moving physically).
This issue only occurs when there's a NetworkAnimator attached to the gameobject. When it is removed, the issue does not occur. Hence this is clearly a bug with the NetworkAnimator.
Reproduce Steps
- Have an NPC mob move around the map with both an Idle and Move State.
- In the Move State, use animator.SetFloat("velocity", x); <- This is runned in FixedUpdate
- OnExitMoveState, use animator.SetFloat("velocity", 0f); to stop the character from playing it's walking animation. <- This is runned in FixedUpdate
- Monitor the issue, sometimes NetworkAnimator does not interfere and the parameter "velocity" is set to 0 while in the "idle" state as it should be, while sometimes "velocity" is not zero in the idle state.
Expected Outcome
Network Animator should not overwrite my script setting the "velocity" parameter to 0 when the Mob shifts from Moving state to Idle state.
Screenshots
If applicable, add screenshots to help explain your problem.
Environment
- OS: Windows 11
- Unity Version: 6000.0.47f1
- Netcode Version: 2.4.2
- Netcode Commit: [e.g. https://github.com/Unity-Technologies/com.unity.netcode.gameobjects/commit/ba418fa5b600ad9eb61fab0575f12fbecc2c6520]
- Netcode Topology: Client-Server (1 Player is the host/server)