Why RPC doesnt work for me
Options
hi, im currently working on a parkour multiplayer game
in the game there is no chat so i decided to make a chat
im making it with RPCs because i found it simple to understand
but somehow my code doesnt work!
here's my code :
in the game there is no chat so i decided to make a chat
im making it with RPCs because i found it simple to understand
but somehow my code doesnt work!
here's my code :
"the sendMessage function not even being called"public void checkChatMessage(string message){
foreach (Command cmd in commands)
{
string wholeCmd = "/" + cmd.name;
if(message.StartsWith(wholeCmd)){
accessCommand(cmd, message);
return;
}
}
if(message.StartsWith("/"))
return;
string formattedMsg = "[!] " + playerName + "<color=#C0C0C0>» </color>" + message;
if(PhotonNetwork.IsMasterClient){
formattedMsg = "<color=#FF3333>[Host] </color>" + playerName + "<color=#C0C0C0>» </color> " + message;
PV.RPC("sendMessage", RpcTarget.AllBuffered, formattedMsg);
return;
}
formattedMsg = "<color=#FF8D33>[!] </color>" + playerName + "<color=#C0C0C0>» </color>" + message;
PV.RPC("sendMessage", RpcTarget.AllBuffered, formattedMsg);
}
[PunRPC]
public void sendMessage(string message){
chat.text += "\n" + message;
//counter to check if the function is being called
count++;
counter.text = "Count:" + count;
}
0
Answers
-
do some debu.log to understand what your code is doing exactly and check your PhotonView component.0
-
i did, its not receiving any data from other clients0
-
Is RPC("method") being called?
It is not recommended to buffer a lot of RPCs. At some point. joining players will struggle to load that growing history...0