PhotonView with ID 2001 has no method marked with the [PunRPC](C#) property! Args: Int32

Options
This is the error i am getting

PhotonView with ID 2001 has no method "RPCFunction" marked with the [PunRPC](C#) or @PunRPC(JS) property! Args: Int32

and this is the Code i am Using

public void CallRPCMethod(int index)

     {
         GetComponent<PhotonView>().RPC("RPCFunction", PhotonTargets.MasterClient, index);
     }
 
 
     [PunRPC]
     public void RPCFunction(int index)
     {
         //int i = int.Parse(index);
         foreach (GemsAndBoosterIndexing indexRefferer in FindObjectsOfType<GemsAndBoosterIndexing>())
         {
             if (index == indexRefferer.index)
             {
                 PhotonNetwork.Destroy(indexRefferer.gameObject);
                 break;
             }
         }
     }
i have no idea why this is happening. Please Help

I have also checked RPC setting in Editor and "RPCFunction" is added in that list.i am using Unity 2018.2

Comments

  • Rivax95
    Options
    up !
  • Alberto
    Alberto
    edited June 2019
    Options
    este seu script com o RPC deve estar no mesmo GameObject que o PhotonView, para conseguir fazer a ligação.
    EDIT (translated from Portuguese to English):
    your script with RPC must be in the same GameObject as PhotonView, in order to work.
  • JohnTube
    JohnTube ✭✭✭✭✭
    Options
    Hi @Alberto,

    Thank you for choosing Photon and for your comment!

    The forum is English only. Consider that next time.
    I will edit your post to translate it now.