Search Unity

Network Animation Lag

Discussion in 'Multiplayer' started by Martins74, Jan 14, 2017.

  1. Martins74

    Martins74

    Joined:
    Jul 21, 2016
    Posts:
    8
    I use Network Animator component and it works fine, because its is transmiting the animations across the network but the animations are just lagging.
     
  2. mischa2k

    mischa2k

    Joined:
    Sep 4, 2015
    Posts:
    4,347
    They will also be a few milliseconds or seconds behind, depending on the ping. If you want the animations to react faster, you should use the default animator and make them all client sided. For example, feed the client's movement speed to the client's animator directly and don't use the server's synchronized movement speed.
     
  3. Rosaki

    Rosaki

    Joined:
    Dec 1, 2016
    Posts:
    18
    So do the ugly, tedious work-around of an animation state machine and send states to all the clients instead of letting Mecanim automatically sync anims? Or is there a better way?
     
  4. mischa2k

    mischa2k

    Joined:
    Sep 4, 2015
    Posts:
    4,347
    Nah I meant do animations like you would do them in single player games. That's what I do in my networking projects, I don't use the NetworkAnimator at all.

    For another example, think about foot step sounds. You could either let the server send a 'do sound now' packet on every foot step (hence latency) or just let the client take care of it whenever the client's feet touch the ground. It's no different for animations.
     
    trombonaut likes this.
  5. Kj756

    Kj756

    Joined:
    Jan 22, 2017
    Posts:
    7
    I’m having the same problem as well. I had my animation working smoothly then I tried to tweak it for multiplayer by using networkanimator. Although the animations play, they stutter or lag. How do you tell the client to do the animation? Can u give a coded example of what you mean because I think that’s the key to solvin my problem
     
  6. mischa2k

    mischa2k

    Joined:
    Sep 4, 2015
    Posts:
    4,347
    In uMMORPG I use a state SyncVar. State is synced to client. Client sends state to animator, done.