private void ImportScenes() { SceneHunter scenePopulator = serializedSceneManager.ScenePopulator. targetObject as SceneHunter; AssetFilter filter = serializedSceneManager.SerializedSceneFilter. targetObject as AssetFilter; IEnumerable <string> retrievedScenes = scenePopulator.GetScenePaths(); IEnumerable <string> includedFiles = filter.FilesToInclude; List <string> allFiles = new List <string>(); allFiles.AddUniqueRange(retrievedScenes); allFiles.AddUniqueRange(includedFiles); allFiles.RemoveAll((x) => !filter.ShouldBeIncluded(x)); OnSceneImport.SafeInvoke(this, new EventArgs <IEnumerable <string> >() { Value = allFiles }); }
private void InitializeDefaults() { SceneManagerAssetPath = AssetDatabase.GetAssetPath(SerializedManager.targetObject); bool wasCreated = false; AssetFilter assetFilter = AssetDatabaseExtensions. FindOrCreateSubScriptableObject <AssetFilter>(SceneManagerAssetPath, "SceneFilter", out wasCreated); if (wasCreated) { assetFilter.IncludeIfNoMatch = true; } SerializedSceneFilter = new SerializedObject(assetFilter); SceneHunter sceneHunter = AssetDatabaseExtensions. GetFirstSubAssetOf <SceneHunter>(SceneManagerAssetPath); if (sceneHunter == null) { sceneHunter = AssetDatabaseExtensions. CreateSubScriptableObject <UnitySceneHunter>(SceneManagerAssetPath, "SceneHunter"); } ScenePopulator = new SerializedObject(sceneHunter); SceneNodes = AssetDatabaseExtensions. FindOrCreateSubScriptableObject <SceneNodeCollection>(SceneManagerAssetPath, "SceneNodes", out wasCreated); if (wasCreated) { SceneNodes.SceneManager = TargetManager; } SceneNodes.PopulateSceneInfos(); SceneNodesObject = new SerializedObject(SceneNodes); SceneNodesProp = SceneNodesObject.FindProperty("sceneNodes"); if (AssetDatabaseExtensions.GetSubAssetsOfType <SceneVariableContainer>(TargetManager).Count() == 0) { TargetManager.SceneVariables.name = "ManagerVariables"; AssetDatabase.AddObjectToAsset(TargetManager.SceneVariables, TargetManager); AssetDatabase.ImportAsset(AssetDatabase.GetAssetPath(TargetManager)); } SerializedManager.ApplyModifiedProperties(); ScenesProp = SerializedManager.FindProperty("scenes"); EntrySceneIdProp = SerializedManager.FindProperty("entrySceneId"); AnyScenesProp = SerializedManager.FindProperty("anyScene"); UseOnPlayProp = SerializedManager.FindProperty("useOnPlay"); GoToOnPlay = SerializedManager.FindProperty("goToOnPlay"); SerializedVariables = new SerializedSceneVariableCollection(TargetManager.SceneVariables); }