private void Update() { if (_tcpClient != null && !_tcpClient.Connected) { _tcpClient.Dispose(); _tcpClient = null; SceneManager.LoadScene(0); } while (_tcpClient != null && _tcpClient.Available > 0) { var command = _tcpClient.AcceptJsonBinaryObject <InputCommand>(); ProcessCommand(command); } }