Dear all,
I attach below script to one child object and add photon view on the child object. Every time I click the UI button, the object moves on my screen but fails to reflecting on the opponents’ screens. Does anyone knows why.
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using Photon.Pun;
public class cannonMove : MonoBehaviourPun, IPunObservable
{
public void shoot()
{
if (shootBomb.ammoAmount >= 1f)
{
this.GetComponent<PhotonView>().RPC("moveBack", RpcTarget.AllBuffered);
}
}
[PunRPC]
public void moveBack()
{
gameObject.transform.Translate(Vector3.right * 1f);
StartCoroutine(backMove1());
}
IEnumerator backMove1()
{
yield return new WaitForSeconds(0.1f);
gameObject.transform.Translate(Vector3.left * 1f);
}
public void OnPhotonSerializeView(PhotonStream stream, PhotonMessageInfo info)
{
throw new System.NotImplementedException();
}
}