Search Unity

Resolved Multiplayer netcode - client animation state flickering between states upon fast movement

Discussion in 'Netcode for GameObjects' started by theguywhoyousaw, Mar 31, 2023.

  1. theguywhoyousaw

    theguywhoyousaw

    Joined:
    Apr 22, 2022
    Posts:
    2
    Hi,
    I am using netcode for gameobjects.
    So this only occurs on client players, host players do not have such issue.

    From within the update() block, only the owner sets animation booleans that are referenced to change state.
    Players are also equipped with a 'Owner network animator' component.

    Animation usually works well, with both players being able to run, jump etc and animations show on both host and client.

    However, upon strange movement (jumping then instantly dashing into floor, for example) the player is able to enter a bugged state, where they flicker between two states. EG:

    Where it flickers between idle and fall and back again, until a new input command is recognized.


    Adding a debug.log to these statements prints that only the 'else' statement is executing at the time of the bug, And additionally: the state from idle to fall
    upload_2023-3-31_17-42-36.png
    And additionally: the state from fall to idle
    upload_2023-3-31_17-42-51.png

    Given the output from my Debug.log() I can only assume this is a strange netcode bug I don't understand?

    Not sure where its originating from but to reiterate:
    Player has animator, network animator, and owner network animator components.
    The bug is only possible to reproduce for client players, and is visible on both client and host.
    The boolean values are set only on the owning client, the server never writes to these.


    This bugged state also exists for running and jumping, depending on the weird movement inputted.

    I would hugely appreciate any help! Best wishes & thanks!



    Resolution:

    I read the documentation as you should if you ever get niche issues like this. I was using the 'OwnerNetworkAnimator' script incorrectly. it should be used on its own, and not alongside 'networkanimator'
    relevant documentation at:
    https://docs-multiplayer.unity3d.com/netcode/current/components/networkanimator/index.html
     
    Last edited: Apr 2, 2023
  2. Iker8av

    Iker8av

    Joined:
    Jan 7, 2020
    Posts:
    2
    Could you show how is you inspector with the OwnerNetworkAnimator script?