void Update()
    {
        // Space key resets the scene to be placed in front of the camera.
        if (Input.GetKeyDown(KeyCode.Space))
        {
            ResetView();
        }

        // Sends virtual keyboards strokes to the TextMeshes for the IP address and the port.
        AbsorbInput();

        kinectReceiver.UpdateFrame();
    }
    void Update()
    {
        // Sends virtual keyboards strokes to the TextMeshes for the IP address and the port.
        AbsorbInput();

        if (Input.GetKeyDown(KeyCode.Tab))
        {
            if (connectionWindow.ConnectionTarget == ConnectionTarget.Controller)
            {
                connectionWindow.ConnectionTarget = ConnectionTarget.Kinect;
            }
            else
            {
                connectionWindow.ConnectionTarget = ConnectionTarget.Controller;
            }
        }

        if (Input.GetKeyDown(KeyCode.Return) || Input.GetKeyDown(KeyCode.KeypadEnter))
        {
            if (connectionWindow.ConnectionTarget == ConnectionTarget.Controller)
            {
                TryConnectToController();
            }
            else
            {
                StartCoroutine(TryConnectToKinect());
            }
        }

        // Gives the information of the camera position and floor level.
        if (Input.GetKeyDown(KeyCode.Space))
        {
            sharedSpaceAnchor.UpdateTransform(cameraTransform.position, cameraTransform.rotation);
        }

        if (Input.GetKeyDown(KeyCode.D))
        {
            sharedSpaceAnchor.DebugVisibility = !sharedSpaceAnchor.DebugVisibility;
        }

        if (controllerClient != null)
        {
            var receiverStates = new List <ReceiverState>();
            if (kinectReceiver != null)
            {
                var receiverState = new ReceiverState(kinectReceiver.SenderEndPoint.Address.ToString(),
                                                      kinectReceiver.SenderEndPoint.Port,
                                                      kinectReceiver.ReceiverSessionId);
                receiverStates.Add(receiverState);
            }
            try
            {
                controllerClient.SendViewerState(receiverStates);
            }
            catch (TcpSocketException e)
            {
                print($"TcpSocketException while connecting: {e}");
                controllerClient = null;
            }
        }

        if (kinectReceiver != null)
        {
            var senderPacketSet = SenderPacketReceiver.Receive(udpSocket);
            if (!kinectReceiver.UpdateFrame(udpSocket, senderPacketSet))
            {
                kinectReceiver          = null;
                ConnectWindowVisibility = true;
            }
        }
    }