- Home /
UNet equivalent of OnDisconnectedFromServer
This is my first attempt at creating a multiplayer game since UNet's release and I am having trouble with one function. In the legacy networking system, there was the function:
OnDisconnectedFromServer(NetworkDisconnection disconnection)
{
}
which could be used to tell if the game client's player disconnected (or was disconnected forcefully) from a game. In UNet, I am having trouble finding the equivalent. The only thing I could think of that might work is doing this:
client.RegisterHandler (MsgType.Disconnect, OnDisconnect);
with the disconnect function:
void OnDisconnect(NetworkMessage msg)
{
Debug.Log ("Disconnected");
}
Yet, even this does not work; the OnDisconnect message never gets executed on the client (it seems registering this handler is only called on the server when a player disconnects from the game). Does anyone know the equivalent -- or how to implement an equivalent -- of OnDisconnectedFromServer in UNet?
Your answer
Follow this Question
Related Questions
Chat system is not working 1 Answer
Commands and ClientRPC are not running when called 0 Answers
Multiple Cars not working 1 Answer