I am using the basic myThirdPersonController script as my movement and animation script. The movements are syncing when i play but the animations are not.
Heres my NetworkCharacter script:
using UnityEngine;
public class NetworkCharacter : Photon.MonoBehaviour
{
private Vector3 correctPlayerPos; // We lerp towards this
private Quaternion correctPlayerRot; // We lerp towards this
// Update is called once per frame
void Update()
{
correctPlayerPos = transform.position;
correctPlayerRot = transform.rotation;
if (!photonView.isMine)
{
transform.position = Vector3.Lerp(transform.position, this.correctPlayerPos, Time.deltaTime * 5);
transform.rotation = Quaternion.Lerp(transform.rotation, this.correctPlayerRot, Time.deltaTime * 5);
}
}
void OnPhotonSerializeView(PhotonStream stream, PhotonMessageInfo info)
{
if (stream.isWriting)
{
// We own this player: send the others our data
stream.SendNext(transform.position);
stream.SendNext(transform.rotation);
myThirdPersonController myC = GetComponent<myThirdPersonController>();
stream.SendNext((int)myC._characterState);
}
else
{
// Network player, receive data
this.correctPlayerPos = (Vector3)stream.ReceiveNext();
this.correctPlayerRot = (Quaternion)stream.ReceiveNext();
myThirdPersonController myC = GetComponent<myThirdPersonController>();
myC._characterState = (CharacterState)stream.ReceiveNext();
}
}
}
I have no idea what i have wrong in the script and need help!!!