public IEnumerator Setup() { var types = AppDomain.CurrentDomain.GetAssemblies() .SelectMany(x => x.GetTypes()) .Where(t => typeof(BenchmarkUtils).IsAssignableFrom(t) && t.IsClass) .OrderByDescending(x => ((BenchmarkUtilsImplPriorityAttribute)Attribute.GetCustomAttribute(x, typeof(BenchmarkUtilsImplPriorityAttribute))).Priority) .ToList(); m_BenchmarkTestsUtils = (BenchmarkUtils)Activator.CreateInstance(types.First()); if (k_IsRunningUnderUtr) { m_ModelFolderPath = Directory.EnumerateDirectories(Directory.GetParent(Application.dataPath).Parent.FullName, ".PerformanceTestProjects", SearchOption.AllDirectories).FirstOrDefault(); QualitySettings.SetQualityLevel(0); Screen.fullScreenMode = FullScreenMode.FullScreenWindow; Screen.fullScreen = true; QualitySettings.vSyncCount = 0; } else { m_ModelFolderPath = FindProjectsPath(); } if (m_ModelFolderPath == null) { Debug.LogError("Unable to find Samples data. Reflect Samples require local Reflect Model data in '.PerformanceTestProjects' in " + Directory.GetParent(Application.dataPath).Parent.FullName); } if (!m_SceneLoaded) { //Load scene SceneManager.sceneLoaded += (s, a) => { m_SceneLoaded = true; }; SceneManager.LoadScene(m_BenchmarkTestsUtils.GetScenePath(), LoadSceneMode.Single); yield return(new WaitWhile(() => m_SceneLoaded == false)); m_BenchmarkTestsUtils.PostSceneSetup(); //Too many exception with UI without user var uiStateManager = Object.FindObjectOfType <UIStateManager>(); if (uiStateManager != null) { uiStateManager.GetComponent <Canvas>().enabled = false; } var loginManager = Object.FindObjectOfType <LoginManager>(); if (loginManager != null) { loginManager.enabled = false; } yield return(null); //Activate Mars session to get the main camera var scene = SceneManager.GetActiveScene(); var rootGameObjects = new List <GameObject>(); scene.GetRootGameObjects(rootGameObjects); foreach (var go in rootGameObjects) { if (go.name.Equals("MARS Session")) { go.SetActive(true); break; } } m_ViewerReflectBootstrapper = UnityEngine.Object.FindObjectsOfType <ViewerReflectBootstrapper>().First(); var actorSystemSetup = UnityEngine.Object.Instantiate(m_ViewerReflectBootstrapper.Asset); //Clear exclude and Migrate to get benchmark Actor actorSystemSetup.ExcludedAssemblies.RemoveAll(x => x == "BenchmarkAssembly"); ActorSystemSetupAnalyzer.InitializeAnalyzer(actorSystemSetup); ActorSystemSetupAnalyzer.PrepareInPlace(actorSystemSetup); ActorSystemSetupAnalyzer.MigrateInPlace(actorSystemSetup); //Create and connect new actor var newProviderSetup = actorSystemSetup.CreateActorSetup <BenchmarkActor>(); actorSystemSetup.ReplaceActor(actorSystemSetup.GetActorSetup <DataProviderActor>(), newProviderSetup); actorSystemSetup.ConnectNet <SpatialDataChanged>(actorSystemSetup.GetActorSetup <DynamicEntryFilterActor>(), newProviderSetup); //Assign root transform to GameObjectBuilderActor and SpatialActor actorSystemSetup.GetActorSetup <GameObjectBuilderActor>().GetActorSettings <GameObjectBuilderActor.Settings>().Root = GameObject.Find("Root").transform; actorSystemSetup.GetActorSetup <SpatialActor>().GetActorSettings <SpatialActor.Settings>().Root = GameObject.Find("Root").transform; //Replace Asset by modified temp asset m_ViewerReflectBootstrapper.Asset = actorSystemSetup; yield return(null); var freeFly = Camera.main.GetComponent <FreeFlyCamera>(); if (freeFly != null) { freeFly.enabled = false; } if (k_IsRunningUnderUtr) { m_ViewerReflectBootstrapper.StartCoroutine(disableVsync()); } yield return(new WaitForSeconds(10)); } }