void OnPlayerDisconnected(NetworkPlayer player) not being called What am i doing wrong?
I am just getting into using networking in Unity however i have noticed that the player disconnected is not being called. I am still using the basic hud script from network manager and i am hosting the game on the editor and joining from a build. I have tried placing this code on a player ,on its own object with and without network identity(with identity was marked as server) but it never seems to get called.What am i doing wrong ?. Below is the exact code
void OnPlayerDisconnected(NetworkPlayer player)
{
Debug.Log ("SomeoneDisconnected");
Network.RemoveRPCs (player);
Network.DestroyPlayerObjects (player);
}
Oddly enough on player connected isnt being called either
Answer by genericname24 · Aug 27, 2017 at 08:04 PM
After lots of trial and error and searching the reason it does not work is that it is depreciated also thought i would post a solution here in case anyone else is in the same boat. I found a working method from forums that does the same as OnPlayerDisconnected and similar methods
Its a post on the Unity forum by user Max_Bol https://forum.unity3d.com/threads/i-forgot-how-to-detect-player-client-server-disconnection-anyone-can-tell-me.358433/