private IEnumerator CheckSensorsRepeatedly() { const string SensorFailureMessage = "Please restart the application"; SlamLocalizer slamLocalizer = GameObject.FindObjectOfType <SlamLocalizer>(); //If the SLAM localizer is not being used then the sensor status cannot be read. if (!slamLocalizer) { yield break; } for (; ;) { //Wait until the sensors should be ready. if (!slamLocalizer.SlamFeedback.CameraReady) { yield return(null); continue; } //The IMU should be ready before the Camera is ready. If not then this is reported as an error. if (!slamLocalizer.SlamFeedback.HasFirstImu) { _controller.ChangeMinorMessage(SensorFailureMessage); _controller.SetTitleVisibility(true); } yield break; } }
private void CheckSensors() { var manager = GameObject.FindObjectOfType <MetaManager>(); _controller = new MetaSensorUiController(); _controller.SetTitleVisibility(false); if (!manager) { Debug.LogError("Could not get MetaManager"); return; } manager.StartCoroutine(CheckSensorsAtIntervals()); manager.StartCoroutine(CheckSensorsRepeatedly()); }