Some RPCs are calling, some not.

Options
Hi,

I have a problem with my RPCs.
For example... This RPC works.. (checking if same IP is in same room already)
this.GetComponent<PhotonView>().RPC("compareIP", PhotonTargets.OthersBuffered, new object[] { nameofme, localIP });
--CODE
[PunRPC]
void compareIP(string name, string ip)
{

string localIP;
using (Socket socket = new Socket(AddressFamily.InterNetwork, SocketType.Dgram, 0))
{
socket.Connect("8.8.8.8", 65530);
System.Net.IPEndPoint endPoint = socket.LocalEndPoint as IPEndPoint;
localIP = endPoint.Address.ToString();
}
if (name != nameofme)
{
string ip_l = localIP;
if (ip == ip_l)
{
leaveToLobby();
}
}
else
{
leaveToLobby();
}
}
--

But this.. does not..
this.GetComponent<PhotonView>().RPC("timeManage", PhotonTargets.Others, new object[] { time });
--
[PunRPC]
void ChatNow(string s)
{

chat.Add(s);
}

(It works when script is started and IT WORKS for one, which has sent it, but not for others, which is... weird.)
(here is my chat rendering)
-- string ff = "";
foreach (string f in chat)
{
ff = f + "\n" + ff;
} --

-- WHEN Enter is pressed
this.GetComponent().RPC("ChatNow", PhotonTargets.All, nameofme + ": " + text);

For example.. this RPC is not called at all...
[PunRPC]
public void TimeManage(int t)
{
time = t;
}

So... Why are some RPCs not called correctly? If needed, I will provide.. for example screen share on discord.
Please note: placing arguments inside "new object[] {}" does not help.

Comments

  • Tobias
    Options
    It's unclear when and how some RPCs are failing / missing. You sometimes use PhotonTargets.All, sometimes .OthersBuffered or .Others. Is that deliberate?

    You need .All, if the local player should execute the RPC, too. The *Buffered keeps the RPC in the server's memory, so new, late-joining players will get it, too.