- Home /
"PhotonView with ID 1001 has no method "ChatMessage" that takes 2 argument(s): String, Object[]" ... But it has....
I have got a chat script and it works, but now I wanted to add the player name. The error says that there is no RPC-Function that takes two arguments, but there is:
[RPC]
void ChatMessage(string playerName, string msg){
messages.Add (playerName + ": " + msg);
}
And that's how I call the function:
PhotonView photonView = PhotonView.Get(this);
photonView.RPC("ChatMessage", PhotonTargets.All, PhotonNetwork.playerName, new object[]{currentMessage});
Can you help me?
Comment
Answer by tobiass · May 09, 2014 at 03:32 PM
ChatMessage takes the arguments string and string. You send a string and a object[]. Try these two variants (maybe they even work both):
photonView.RPC("ChatMessage", PhotonTargets.All, new object[]{PhotonNetwork.playerName, currentMessage});
photonView.RPC("ChatMessage", PhotonTargets.All, PhotonNetwork.playerName, currentMessage);
Your answer
Follow this Question
Related Questions
Photon Unity Networking Chat System Problems... 1 Answer
Photon RPC "DestroyRpc" function not found 1 Answer
Photon/Network - Killing A Client Enemy Unit 3 Answers
Problem with Network Connection 1 Answer
Send gameobject through photon RPC 1 Answer