void OnApplicationQuit() { if (GameOverPanel.activeSelf) { MessageRoomPacket packet = new MessageRoomPacket(GameProtocol.QuitAfterGameOver(), Singleton.Instance.RoomID, Singleton.Instance.Me.Username); Singleton.Instance.Connection.SendPacket(packet.getData()); Singleton.Instance.Connection.CloseSocket(); } else { MessageRoomPacket packet = new MessageRoomPacket(GameProtocol.QuitWhileInGame(), Singleton.Instance.RoomID, Singleton.Instance.Me.Username); Singleton.Instance.Connection.SendPacket(packet.getData()); Singleton.Instance.Connection.CloseSocket(); } }