private static void DetectSceneDeletion(string[] deletedAssets) { foreach (string assetPath in deletedAssets) { if (Path.GetExtension(assetPath) == TypedSceneSettings.SceneExtension && !TypedSceneValidator.ValidateSceneDeletion(Path.GetFileNameWithoutExtension(assetPath))) { TypedSceneStorage.Delete(Path.GetFileNameWithoutExtension(assetPath)); } } }
private static void DetectSceneDeletion(string[] deletedAssets) { foreach (string assetPath in deletedAssets) { if (Path.GetExtension(assetPath) == TypedSceneSettings.SceneExtension && !TypedSceneValidator.ValidateSceneDeletion(Path.GetFileNameWithoutExtension(assetPath))) { var newSceneList = new List <EditorBuildSettingsScene>(EditorBuildSettings.scenes); newSceneList.RemoveAll(scene => scene.path == assetPath); EditorBuildSettings.scenes = newSceneList.ToArray(); TypedSceneStorage.Delete(Path.GetFileNameWithoutExtension(assetPath)); } } }
private static void DetectSceneImport(string[] importedAssets) { foreach (string assetPath in importedAssets) { if (Path.GetExtension(assetPath) == TypedSceneSettings.SceneExtension && TypedSceneValidator.ValidateSceneImport(assetPath)) { var name = Path.GetFileNameWithoutExtension(assetPath); var guid = AssetDatabase.AssetPathToGUID(assetPath); var sourceCode = TypedSceneGenerator.Generate(name, guid); TypedSceneStorage.Save(name, sourceCode); } } }
private static void DetectSceneImport(string[] importedAssets) { foreach (string assetPath in importedAssets) { if (Path.GetExtension(assetPath) == TypedSceneSettings.SceneExtension && TypedSceneValidator.ValidateSceneImport(assetPath)) { var name = Path.GetFileNameWithoutExtension(assetPath); var sourceCode = TypedSceneGenerator.Generate(name, name, AssetDatabase.AssetPathToGUID(assetPath)); var guid = AssetDatabase.AssetPathToGUID(assetPath); if (!EditorBuildSettings.scenes.Any(scene => scene.guid.ToString() == guid)) { var newSceneList = new List <EditorBuildSettingsScene>(EditorBuildSettings.scenes); newSceneList.Add(new EditorBuildSettingsScene(assetPath, true)); EditorBuildSettings.scenes = newSceneList.ToArray(); } TypedSceneStorage.Save(name, sourceCode); } } }