Hi,
I have a problem with RPC, when i try to send an RPC while i quit my application RPC are don’t called, how can i fix it?
tobiass
2
Sending of the RPC fails, because it does not get sent immediately when you call it. RPC’s are sent in intervals (like other messages) by default. This allows us to aggregate some messages.
Your code creates a message that would be send in the next interval but that doesn’t happen anymore (due to app quit).
PUN should call PhotonNetwork.Disconnect() in it’s own OnApplicationQuit() implementation. This a) will attempt to send immediately and b) tells the server that you are closing the app, too. The connection will be closed and the others get an update, too!
You can implement:
void OnPhotonPlayerDisconnected(PhotonPlayer otherPlayer)
{
// AddChatMessage (otherPlayer.name + " è uscito");
}