public override void Execute(ConvertData convertSettings) { base.Execute(convertSettings); List <GeneralEditorIndicator.Task> tasks = new List <GeneralEditorIndicator.Task>(); foreach (string path in this.TargetPaths) { string assetPath = path; tasks.Add(new GeneralEditorIndicator.Task( () => { try { this.ChangeLayer(assetPath, convertSettings); } catch (Exception e) { if (convertSettings.isStopConvertOnError) { this.IsInterruption = true; throw; } Debug.LogException(e); } }, assetPath )); } GeneralEditorIndicator.Show("LayerIdConverter - Prefab", tasks, () => { this.IsCompleted = true; }); }
public static void Show(string title, List <Task> taskList, Action onComplete) { if (taskList == null || taskList.Count <= 0) { onComplete?.Invoke(); return; } GeneralEditorIndicator generalEditorIndicator = new GeneralEditorIndicator(); generalEditorIndicator.Prepare(title, taskList, onComplete); }
public override void Execute(ConvertData convertSettings) { base.Execute(convertSettings); EditorSceneManager.SaveOpenScenes(); this.currentScenePath = UnityEngine.SceneManagement.SceneManager.GetActiveScene().path; List <GeneralEditorIndicator.Task> tasks = new List <GeneralEditorIndicator.Task>(); foreach (string path in this.TargetPaths) { string assetPath = path; tasks.Add(new GeneralEditorIndicator.Task( () => { try { this.ChangeLayer(assetPath, convertSettings); } catch (Exception e) { if (convertSettings.isStopConvertOnError) { this.IsInterruption = true; EditorSceneManager.OpenScene(this.currentScenePath); throw; } Debug.LogException(e); } }, assetPath )); } GeneralEditorIndicator.Show( "LayerIdConverter - Scene", tasks, () => { EditorSceneManager.OpenScene(this.currentScenePath); this.IsCompleted = true; } ); }