void Update() { switch (_recenterState) { // Run recenter once as soon as RenderManager is available case RecenterState.Initial: // Check if rendering is setup if (_displayController.RenderManager == null || _displayController.transform.Find("VREye1/VRSurface0") == null) { break; } // Run recenter once (this code isn't helpful now but will be if we remove the "press space to continue" feature) try { Recenter(); } catch (Exception e) { Debug.LogError("Unable to set room rotation at launch:\n\tMessage: " + e.Message + "\nTrace:\n" + e.StackTrace); } _recenterState = RecenterState.Automatic; // Show colored background rather than skybox foreach (Camera cam in _displayController.GetComponentsInChildren <Camera>()) { cam.clearFlags = CameraClearFlags.Color; } break; // Help text follows look until user recenters once manually case RecenterState.Automatic: // Update help text pose FollowHelpText.transform.position = PoseSource.transform.position + PoseSource.transform.forward.normalized * FollowHelpTextDistance + PoseSource.transform.up.normalized * FollowHelpTextHeightOffset; FollowHelpText.transform.rotation = Quaternion.LookRotation(PoseSource.transform.forward, PoseSource.transform.up); // Once user recenters, hide follow help text and show world if (CheckUserRecentered()) { _recenterState = RecenterState.User; FollowHelpText.SetActive(false); World.SetActive(true); foreach (Camera cam in _displayController.GetComponentsInChildren <Camera>()) { cam.clearFlags = CameraClearFlags.Skybox; } } break; // Process further recenter requests case RecenterState.User: CheckUserRecentered(); break; } }