IEnumerator LoadModelAsync(String sceneName, Vector3 position, Quaternion rotation, float rotationY) { m_loadingProject = true; if (m_panelLoadingModel) { m_panelLoadingModel.SetActive(true); } // The Application loads the Scene in the background as the current Scene runs. AsyncOperation asyncLoad = SceneManager.LoadSceneAsync(sceneName, LoadSceneMode.Additive); // Wait until the asynchronous scene fully loads while (!asyncLoad.isDone) { yield return(null); } m_model = GameObject.Find("World"); if (m_model) { // Disable all lights in the model. var transformLighting = m_model.transform.Find("Construction/Phases/Final/Lighting"); if (transformLighting) { var gameObjectLighting = transformLighting.gameObject; if (gameObjectLighting) { gameObjectLighting.SetActive(false); } } // Instantiate model at the stored location. m_model.transform.position = position; m_model.transform.rotation = rotation; // Compensate for the hitPose rotation facing away from the raycast (i.e. camera). m_model.transform.Rotate(0, rotationY, 0, Space.Self); if (m_modelAnchor) { // Make model a child of the model anchor. m_model.transform.parent = m_modelAnchor.transform; } } var layerManager = gameObject.GetComponent <LayerManager>(); layerManager.DynamicallyCreateLayers(); m_menuLayer.Init(layerManager); if (m_panelLoadingModel) { m_panelLoadingModel.SetActive(false); } m_loadingProject = false; }