Photon: Movement not reflecting on opponents screen

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();
    }
}

Are you instantiating the object with PhotonNetwork.Instantiate, so that the same networked object is known to all players in a room?

You should not use RpcTarget.AllBuffered for this. It will put the RPC in a cache server-side and new players will get each shot on join…

Please have a look at the Basics Tutorial for PUN 2 and code along. It covers movement and RPCs and might help you find the logic problem.

Hi Tobiass,

Yes, I have instantiated the mother object. It is the child object under it. The script is attached under the child object with UI click. The movement is visible only at the self screen. I’ve attached photon view transform at each child objects and observe them but still with no luck.