Photon view Rpc call

Options

Hi @Tobias,

we are facing the below issue while call Rpc function:

Received RPC "SendMyPosGroup" for viewID 16 but this PhotonView does not exist! Was remote PV. Remote called. By: #01 '' Maybe GO was destroyed but RPC not cleaned up.

Consider the below scenario:

We have set of n number of prefab instantiation from api server, so we have create photon view component and set view id after unity instantiation.

We have got the issue once instantiated prefab destroy using destroy(gameobject) and then load the new set of prefabs and set photon view id.

[PunRPC]

    public void SendMyPosGroup(Vector3 pos,Quaternion rot){

        transform.localRotation = rot;

        transform.localPosition = pos;

    }


Before rpc call send, we have done clear rpc bufferif mine.

Please check and let me know the above issue.

Thanks in Advance.

Comments

  • Tobias
    Options

    Please clarify what you mean by "rpc bufferif mine". Also, who is calling this and when? And .. are there any buffered RPCs at all?

    The problem is most likely that you GameObject.Destroy the object with the PhotonView 16. However, someone is sending an RPC for this object, before that client (hopefully) also destroys the PV. Due to lag and timing in general, there may be cases when RPCs arrive after a PhotonView was destroyed.

    If this doesn't affect the gameplay, you may chose to ignore (or comment-out) the log. Or you can refactor the code and timing to make sure it's clear you destroy the object and no RPCs get called on it anymore.

    That said: It's not recommended to update position and rotation with RPCs. At least not, if an object moves frequently.

    If you don't want to use the PhotonView observed lists and don't use PhotonNetwork.Instantiate, you may want to skip all of that and simply implement your synchronization with PhotonNetwork.RaiseEvent, which does not need PhotonViews.