PhotonView with ID 1002 has no method "duello" marked with the [PunRPC](C#) or @PunRPC(JS) property!

Oyun
Oyun
Hello,

I wan't to write a code for send data to other players an i wrote this script in C#;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;

public class inviteDuel : MonoBehaviour
{
//some codes....

public void cagir()
{
if (int.Parse(lap.text) > 0 && int.Parse(bet.text) > 0)
{

//!!!!!!!!! CALLING "duello" function at this line !!!!!!!!!!!!!!!!
player1.GetPhotonView().RPC("duello", PhotonPlayer.Find(player2.GetPhotonView().viewID), player1.GetPhotonView().ownerId, player2.GetPhotonView().ownerId, 1, lap.text, bet.text, player1.GetPhotonView().owner.NickName);<br>
//!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

waiting.SetActive(true);

}
}
[PunRPC]
void duelloKabul(int player1, int player2, int raceType, int bet, int raceLap)<br>
{
//OTHER RPC CODE...
}

[PunRPC]
void duello(int player1, int player2, int raceType, string bet, string raceLap, string davetEden)
{
Debug.Log("Duello want: " + davetEden);

//...
// CODES
//

}
}
And when i call the cagir() function, i got this error message from other player;
PhotonView with ID 2001 has no method "duello" marked with the [PunRPC](C#) or @PunRPC(JS) property! Args: Int32, Int32, Int32, String, String, String
UnityEngine.Debug:LogError(Object)
Thanks...

Comments

  • JohnTube
    JohnTube ✭✭✭✭✭
    Hi @Oyun,

    Thank you for choosing Photon!

    RPC methods need to be in a component attached to the same GameObject as the PhotonView.