protected IEnumerator UpdateCoroutine(List <ScreenshotResolution> resolutions, bool restoreFocus = false) { if (m_IsUpdating) { yield break; } // Save current focused window m_PreviousWindowFocus = EditorWindow.focusedWindow; m_IsUpdating = true; // Debug.Log ("Update: need backup"); m_NeedsBackup = true; onUpdateBeginDelegate(); // Safe area in auto refresh if (Application.isPlaying && m_ConfigAsset.m_AutoRefresh && m_ConfigAsset.m_DrawSafeArea && m_SafeAreaInstance == null) { m_SafeAreaInstance = GameObject.Instantiate(m_ConfigAsset.m_SafeAreaCanvas.gameObject); } foreach (ScreenshotResolution res in resolutions) { DeviceInfo.m_CurrentDevice = res; // Capture the textures yield return(m_ScreenshotTaker.StartCoroutine(m_ScreenshotTaker.CaptureResolutionCoroutine(res, new List <Camera>(), m_SafeAreaInstance == null && m_ConfigAsset.m_DrawSafeArea && DeviceInfo.HasSimulatedSafeAreaValue() ? new List <Canvas> { m_ConfigAsset.m_SafeAreaCanvas } : new List <Canvas>(), ScreenshotTaker.CaptureMode.GAMEVIEW_RESIZING))); // Capture the masks if (m_ConfigAsset.m_DrawingMode != PreviewConfigAsset.DrawingMode.TEXTURE_ONLY) { yield return(m_ScreenshotTaker.StartCoroutine(CaptureMasks(res))); } if (m_ConfigAsset.m_AutoRefresh == false) { DeviceInfo.m_CurrentDevice = null; } } if (!(Application.isPlaying && m_ConfigAsset.m_AutoRefresh) || !m_ConfigAsset.m_DrawSafeArea) { GameObject.DestroyImmediate(m_SafeAreaInstance); } m_LastEditorUpdate = DateTime.Now; Repaint(); DestroyManager(); onUpdateEndDelegate(); // Force final repaint if (!Application.isPlaying) { GameViewController.SetGameViewSize(Screen.width, Screen.height); SceneView.RepaintAll(); Repaint(); } // Restore previous focus windows if (m_PreviousWindowFocus != null) { m_PreviousWindowFocus.Focus(); Repaint(); } if (m_ConfigAsset.m_BackupPreviewToDisk) { BackUpDevicePreview(); } m_IsUpdating = false; }