Reputation: 81
I have two RPC calls sent from GameManager
PUNPlayerManager.LocalPlayerInstance.GetComponent().SetDuelGameRPC(duelGameString); PUNPlayerManager.LocalPlayerInstance.GetComponent().SetInGameRPC(true);
On the player instance:
public void SetDuelGameRPC(string duelGame) //To be called by masterClient
{
photonView.RPC("SetInGame", RpcTarget.All, duelGame);
}
[PunRPC]
private void SetDuelGame(string duelGame)
{
Debug.Log("received gameString " + duelGame);
this.duelGameString = duelGame;
}
public void SetInGameRPC(bool inGame) //To be called by masterClient
{
photonView.RPC("SetInGame", RpcTarget.All, inGame);
}
[PunRPC]
private void SetInGame(bool inGame)
{
this.inGame = inGame;
}
The good: Everything works fine on standalone (PC) build
The bad: On android emulator and Unity Editor;
PhotonView with ID 1001 has no method "SetInGame" that takes 1 argument(s): String UnityEngine.Debug:LogError(Object) Photon.Pun.PhotonNetwork:ExecuteRpc(Hashtable, Player) (at Assets/Photon/PhotonUnityNetworking/Code/PhotonNetworkPart.cs:507) Photon.Pun.PhotonNetwork:RPC(PhotonView, String, RpcTarget, Player, Boolean, Object[]) (at Assets/Photon/PhotonUnityNetworking/Code/PhotonNetworkPart.cs:1233) Photon.Pun.PhotonNetwork:RPC(PhotonView, String, RpcTarget, Boolean, Object[]) (at Assets/Photon/PhotonUnityNetworking/Code/PhotonNetwork.cs:2668) Photon.Pun.PhotonView:RPC(String, RpcTarget, Object[]) (at Assets/Photon/PhotonUnityNetworking/Code/PhotonView.cs:415) PUNPlayerManager:SetDuelGameRPC(String) (at Assets/Scripts/PUN/PUNPlayerManager.cs:101) GameManager:PrepareDuelGame() (at Assets/Scripts/PUN/GameManager.cs:131) GameManager:Update() (at Assets/Scripts/PUN/GameManager.cs:162)
Upvotes: 0
Views: 1266
Reputation: 41
public void SetInGameRPC(bool inGame) //To be called by masterClient
{
var _photonView = this.GetComponent<PhotonView>();
_photonView.RPC("SetInGame", RpcTarget.All, inGame);
}
Try this code
I think the photonView variable in the PUNPlayerManager is incorrectly specified.
Upvotes: 1