Unity - Sending RPC working on Standalone (PC), but not on Android

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 an PC
The bad: On android emulator and Unity Editor;
1. The first call SetDuelGameRPC seems to be ignored
2. I get the following error for both players

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)

Comments

  • I could not find the exact reason for the issue.
    However, I modified the code to use RaiseEvent system which works as anticipated and seems more flexible than PunRPC approach.
    I hope this helps someone as well.
Sign In or Register to comment.