/// <summary> /// Coroutine that launches the rendering initialization process. /// </summary> /// <returns></returns> private IEnumerator LaunchRenderingCoroutine() { #if UNITY_EDITOR // Check if the object is selected. Deselected(); processing.Deselected(); if (gameObject == Selection.activeGameObject) { processing.Selected(); } #endif //UNITY_EDITOR // Check the camera models. if (processing.cameraSetup.cameraModels == null) { processing.cameraSetup.FindCameraModels(); } // Initialize the main camera. InitializeCamera(); // Initialize the blending method. yield return(StartCoroutine(selectedBlendingMethod.InitializeRenderingMethodCoroutine())); #if UNITY_EDITOR // Initialize the evaluation method. selectedEvaluationMethod.InitializeEvaluationMethod(); // Load the preview images. yield return(StartCoroutine(processing.PrepareLoadingSourceImagesAsPreviewCoroutine())); if (gameObject == Selection.activeGameObject) { LoadRenderedViewAsPreview(); } #endif //UNITY_EDITOR // Unload the asset bundle. yield return(null); GeneralToolkit.UnloadAssetBundleInMemory(false); // Indicate that loading has finished. _launched = true; Debug.Log(GeneralToolkit.FormatScriptMessage(this.GetType(), "Finished initialization for object " + gameObject.name + ".")); // Send an event on loading finished. if (OnLoadingFinished != null) { OnLoadingFinished(); } }