Hi guys,
I’m looking for a way to kick a player during OnServerAddPlayer in my custom UNETManager. I’ve seen similar topics around here but none are attempting to do the disconnect this early.
Network.CloseConnection needs a NetworkPlayer, which I don’t have yet. All I have is a NetworkConnection. If I call Disconnect on that NetworkConnection it does kick the player but generates a few errors on the Server (Failed to send internal buffer channel:0 bytesToSend:1302
UnityEngine.Networking.NetworkIdentity:UNetStaticUpdate())
Any advice? Thanks in advance.
public override void OnServerAddPlayer(NetworkConnection conn, short playerControllerId)
{
if (TestToSeeIfPlayerCanConnect())
{
// Carry on connecting as normal...
}
else
{
// this causes errors
conn.Disconnect();
}
}