I use Photon Pun 2 to create my game. When playing an animation, it first lags, and then begins to play normally

45 views Asked by At

I use Photon Pun 2 to create my game. When playing animation on other clients, it first lags, and then starts playing normally. At the same time, on my client the animation plays immediately smoothly. I use blend tree. Animator weighs on child object of player "Body". while the value of the horizontalInput or verticalInput variable changes from 0 to 1, the animation pauses, as soon as the value of the variables reaches 1, the animation begins to play smoothly.PlayerSMG hierarchy, PlayerSMG inspector, Body inspector, Body animator, Body blend tree

I tried to read the documentation, but I found what I needed, I will be very grateful if you can tell me how to solve this problem or provide a link to literature that will help me figure this out

`

public class PlayerBodyAnimationScript : MonoBehaviour
{
    [SerializeField] private Animator playerBodyAnimator;
    private PhotonView photonView;
    void Start()
    {
        photonView = GetComponent<PhotonView>();
    }
    void Update()
    {
        if (!photonView.IsMine)
        {
            return;
        }

        float horizontalInput = Input.GetAxis("Horizontal");
        float verticalInput = Input.GetAxis("Vertical");

        playerBodyAnimator.SetFloat("Horizontal", horizontalInput);
        playerBodyAnimator.SetFloat("Vertical", verticalInput);

    }
}

`

0

There are 0 answers