private IEnumerator WaitForFirstActiveScene(RecordingInputModule.InputModuleRecordingData recordingData, int timeoutSecs) { var touchData = recordingData.GetAllTouchData(); if (touchData.Count > 0) { var startTime = DateTime.UtcNow; var firstActionScene = touchData[0].scene; if (!string.IsNullOrEmpty(firstActionScene) && SceneManager.GetActiveScene().name != firstActionScene) { logger.Log($"Waiting for scene {firstActionScene} to load"); } while (!string.IsNullOrEmpty(firstActionScene) && SceneManager.GetActiveScene().name != firstActionScene) { var elapsed = DateTime.UtcNow.Subtract(startTime).TotalSeconds; logger.Log(elapsed); if (elapsed >= timeoutSecs) { logger.LogError($"Timeout wile waiting for scene {firstActionScene} to load"); break; } yield return(new WaitForSeconds(1)); } } }
private void CreateCompositeRecordingFile(string newFilePath, bool copyToPDP = false) { RecordingInputModule.InputModuleRecordingData recordingDataInstance = new RecordingInputModule.InputModuleRecordingData(); recordingDataInstance.recordingType = RecordingInputModule.InputModuleRecordingData.type.composite; foreach (var recording in recordingsToCombine) { var fileName = SanitizeRecordingName(recording); if (copyToPDP) { // Copy segment recordings to persistentDataPath var destPath = Path.Combine(AutomatedQARuntimeSettings.RecordingFolderName, fileName); var sourcePath = Path.Combine("Assets", AutomatedQARuntimeSettings.RecordingFolderName, fileName); File.Copy(sourcePath, destPath, true); } if (string.IsNullOrEmpty(recordingDataInstance.entryScene)) { var segmentPath = Path.Combine("Assets", AutomatedQARuntimeSettings.RecordingFolderName, fileName); var segment = RecordingInputModule.InputModuleRecordingData.FromFile(segmentPath); recordingDataInstance.entryScene = segment.entryScene; } recordingDataInstance.AddRecording(fileName); } recordingDataInstance.AddPlaybackCompleteEvent(); recordingDataInstance.SaveToFile(newFilePath); var alertContainer = rootVisualElement.Q <VisualElement>("HelpBox"); var message = $"Composite recording successfully created at: {newFilePath}. Note: there may be a short delay (<1min) before your new file appears"; CreateIMGUIHelpBox(alertContainer, message, MessageType.Info); Debug.LogWarning(message); AssetDatabase.Refresh(); }
private IEnumerator LoadEntryScene(RecordingInputModule.InputModuleRecordingData recordingData) { if (config.loadEntryScene && !string.IsNullOrEmpty(recordingData.entryScene)) { logger.Log($"Load Scene {recordingData.entryScene}"); var loadSceneAsync = SceneManager.LoadSceneAsync(recordingData.entryScene); float timer = AutomatedQARuntimeSettings.DynamicLoadSceneTimeout; while (!loadSceneAsync.isDone && timer > 0) { yield return(null); timer -= Time.deltaTime; } if (!loadSceneAsync.isDone && timer <= 0) { yield return(null); } } yield return(WaitForFirstActiveScene(recordingData, 60)); }