Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice
  3. Join us on November 16th, 2023, between 1 pm and 9 pm CET for Ask the Experts Online on Discord and on Unity Discussions.
    Dismiss Notice
  4. Dismiss Notice

Third Party Mirror - Clients not syncing animations from a blend tree?

Discussion in 'Multiplayer' started by BrettusTheLettus, Apr 28, 2021.

  1. BrettusTheLettus

    BrettusTheLettus

    Joined:
    Aug 6, 2020
    Posts:
    15
    Hi All,

    I have a player object and running a blend tree to change animations (idle to running) with animator and network animation components. Client-authority is checked for the network animator. But it seems the client animation doesn't update according to the blend tree.
    Edit: Key points from test plays:
    - Clients can see the idle animation and host running but cannot reach the run animation side of the blend tree.
    - Host can see all blend tree animations for the clients.
    - when running server and having two clients they cannot see running animation between themselves.

    How do I fix this? Still new to networking so just trying to get a handle on it. Here is my code and inspector:
    Code (CSharp):
    1.  
    2. using System.Collections;
    3. using System.Collections.Generic;
    4. using UnityEngine;
    5. using UnityEngine.AI;
    6. using Mirror;
    7.  
    8. public class PlayerAnimator : NetworkBehaviour
    9. {
    10.  
    11.    NavMeshAgent agent;
    12.    public Animator anim;
    13.    float motionSmoothTime = .1f;
    14.  
    15.    // Start is called before the first frame update
    16.     void Start()
    17.     {
    18.    agent = gameObject.GetComponent<NavMeshAgent>();
    19.     }
    20.  
    21.     [ClientCallback] // So the host is playing the animation and receiving aninations but other clients are not sending updates of animations.
    22.     private void Update() // So only the idle animations is played. Maybe the clients dont have authority?
    23.     {
    24.         if (!hasAuthority) { return; }
    25.         float speed = agent.velocity.magnitude / agent.speed;
    26.    anim.SetFloat("Blend",speed,motionSmoothTime, Time.deltaTime);
    27.     }
    28. }
    29.  
    Inspector:
    upload_2021-4-28_11-14-43.png
     
    Last edited: Apr 28, 2021
    AdriaAbellaVisyon likes this.
  2. mischa2k

    mischa2k

    Joined:
    Sep 4, 2015
    Posts:
    4,331
    You probably already sync state to your clients.
    Feed that state to your client's animator.
    Don't need NetworkAnimator. It only exists because we inherited it from UNET :)
     
  3. haoyuchen

    haoyuchen

    Joined:
    May 22, 2021
    Posts:
    2
    same problem here
     
  4. AdriaAbellaVisyon

    AdriaAbellaVisyon

    Joined:
    Sep 17, 2018
    Posts:
    1
    I'm experiencing the same problem. My non-local avatars are froze mid walk animation as they move.
     
  5. Ku4rtz

    Ku4rtz

    Joined:
    Dec 30, 2020
    Posts:
    1
    Same problem here.