protected IEnumerator UpdateCoroutine(List <ScreenshotResolution> resolutions, List <ScreenshotCamera> cameras, List <ScreenshotOverlay> overlays, bool export = true, bool playSoundMask = true) { InitScreenshotTaker(); // BATCHES var batches = m_Config.GetActiveBatches(); for (int b = 0; m_Config.m_BatchMode == ScreenshotConfig.BatchMode.BATCHES && b < batches.Count || b == 0; ++b) { // Get batch if any ScreenshotBatch currentBatch = null; if (m_Config.m_BatchMode == ScreenshotConfig.BatchMode.BATCHES && batches.Count > 0) { currentBatch = batches [b]; } // COMPOSERS var composers = m_Config.GetActiveComposers(); for (int c = 0; m_Config.m_CompositionMode == ScreenshotConfig.CompositionMode.COMPOSITION && c < composers.Count || c == 0; ++c) { // Get composer if any m_CurrentComposerInstance = null; if (m_Config.m_CompositionMode == ScreenshotConfig.CompositionMode.COMPOSITION && composers.Count > 0) { m_CurrentComposerInstance = GameObject.Instantiate <ScreenshotComposer> (composers [c]); } // RESOLUTIONS foreach (ScreenshotResolution resolution in resolutions) { // Debug.Log ("Current resolution " + resolution.ToString ()); // LAYERS for (int l = 0; m_Config.m_ExportToDifferentLayers && l < cameras.Count || l == 0; ++l) { // Get layer if any ScreenshotCamera separatedLayerCamera = null; List <ScreenshotCamera> currentCameras; if (m_Config.m_ExportToDifferentLayers && cameras.Count > 1) { // Capture only the current layer camera separatedLayerCamera = cameras [l]; currentCameras = new List <ScreenshotCamera> { separatedLayerCamera }; } else { // Capture all camera currentCameras = new List <ScreenshotCamera> (cameras); } // PRE PROCESS // Debug.Log ("Pre process"); if (currentBatch != null) { foreach (ScreenshotProcess p in currentBatch.m_PreProcess) { p.Process(resolution); yield return(StartCoroutine(p.ProcessCoroutine(resolution))); } } // Sound if (m_Config.m_PlaySoundOnCapture && playSoundMask) { PlaySound(); } // CAPTURE // Debug.Log ("Capture"); if (m_CurrentComposerInstance == null) { yield return(StartCoroutine(m_ScreenshotTaker.CaptureAllCoroutine(new List <ScreenshotResolution> { resolution }, currentCameras, overlays, (m_Config.m_CaptureMode == ScreenshotTaker.CaptureMode.GAMEVIEW_RESIZING && m_Config.m_ResolutionCaptureMode == ScreenshotConfig.ResolutionMode.GAME_VIEW) ? ScreenshotTaker.CaptureMode.FIXED_GAMEVIEW : m_Config.m_CaptureMode, (int)m_Config.m_MultisamplingAntiAliasing, m_Config.m_CaptureActiveUICanvas, m_Config.m_ColorFormat, m_Config.m_RecomputeAlphaLayer, m_Config.m_StopTimeOnCapture))); } else { yield return(StartCoroutine(m_CurrentComposerInstance.CaptureCoroutine(resolution, currentCameras, overlays, (m_Config.m_CaptureMode == ScreenshotTaker.CaptureMode.GAMEVIEW_RESIZING && m_Config.m_ResolutionCaptureMode == ScreenshotConfig.ResolutionMode.GAME_VIEW) ? ScreenshotTaker.CaptureMode.FIXED_GAMEVIEW : m_Config.m_CaptureMode, (int)m_Config.m_MultisamplingAntiAliasing, m_Config.m_CaptureActiveUICanvas, m_Config.m_ColorFormat, m_Config.m_RecomputeAlphaLayer, m_Config.m_StopTimeOnCapture))); } // POST PROCESS // Debug.Log ("Post process"); if (currentBatch != null) { foreach (ScreenshotProcess p in currentBatch.m_PostProcess) { p.Process(resolution); yield return(StartCoroutine(p.ProcessCoroutine(resolution))); } } // EXPORT if (export) { string currentBatchName = currentBatch == null ? "" : currentBatch.m_Name; string currentComposerName = m_CurrentComposerInstance == null ? "" : m_CurrentComposerInstance.name.Replace("(Clone)", ""); string currentCameraName = separatedLayerCamera == null ? "" : separatedLayerCamera.m_Camera.name; // Update the filenames with the camera name as layer name UpdateFileName(resolution, currentCameraName, currentBatchName, currentComposerName); // Export if (TextureExporter.ExportToFile(resolution.m_Texture, resolution.m_FileName, m_Config.m_FileFormat, (int)m_Config.m_JPGQuality)) { Debug.Log("Screenshot created : " + resolution.m_FileName); onResolutionExportSuccessDelegate(resolution); } else { Debug.LogError("Failed to create : " + resolution.m_FileName); onResolutionExportFailureDelegate(resolution); } } } } if (m_CurrentComposerInstance != null) { GameObject.DestroyImmediate(m_CurrentComposerInstance.gameObject); } } } }