Multiplayer. Destroying player object on Host/Server

Hi all

I have a very rudimentary multiplayer game set up and mostly working.
There is however one irritating bug.
When the Server player disconnects and then re-starts the server clients then see extra players, as though one or more of them has been duplicated.

I have a hunch that it’s connected to the function below, which somewhat surprisingly isn’t called when the server disconnects.

Any clues for the clueless ?

	void	OnPlayerDisconnected (NetworkPlayer player)
	{
		Debug.Log("Host Destroyed disconnected Player"+player.ipAddress);
		
		Network.RemoveRPCs(player, 0);
		Network.DestroyPlayerObjects(player);

		PlayerCamera.CameraTarget=transform;
	}

when you instantiate the GameObject of the player keep it in a list or array and when the player disconnects delete that object form the list/array.

What i usualy do is:

make a Player object in the player object you have all the player variables.

like networkPlayer, gameObject etc.

then you loop on a disconnect trough all players and check the NP, if it matches destroy the GameObject.

Cheers

hey!
this function above is called only on the server side whenever a client is disconected.
If you want a function to be called when the server disconects from the client on the client side then it’s OnDisconnectedFromServer