/// <inheritdoc /> public virtual void SetupTrainingScene() { List <GameObject> sceneObjects = SceneUtils.GetActiveAndInactiveGameObjects().ToList(); // Delete duplicated deactivated Hub SDK game objects. IEnumerable <GameObject> oldPrefabs = sceneObjects.Where(obj => obj != null && PrefabsToDestroy.Contains(obj.name)); if (oldPrefabs.Any() && EditorUtility.DisplayDialog("Outdated Prefabs found", "Prefabs from the Hub-SDK detected inside of your scene, do you want to delete them?", "Delete", "Cancel")) { foreach (GameObject oldPrefab in oldPrefabs) { Object.DestroyImmediate(oldPrefab); } } if (File.Exists("hub-logging-config.json") == false) { TextAsset configFile = Resources.Load <TextAsset>("hub-logging-config"); if (configFile != null) { File.WriteAllText("hub-logging-config.json", configFile.text); logger.Info("Copied logging config"); } } SetupVRTK(); // Create default save folder. Directory.CreateDirectory(DefaultCourseStreamingAssetsFolder); // Initialize training configuration. SceneUtils.SetupTrainingConfiguration(); logger.Info("Scene setup is complete."); }
public virtual void TearDown() { foreach (GameObject gameObject in SceneUtils.GetActiveAndInactiveGameObjects()) { if (gameObject.name == "Code-based tests runner") { continue; } if (gameObject.GetComponents(typeof(Component)).Any(component => component.GetType().IsSubclassOfGenericDefinition(typeof(UnitySingleton <>)))) { continue; } Object.DestroyImmediate(gameObject, false); } CoroutineDispatcher.Instance.StopAllCoroutines(); }