示例#1
0
        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 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;
            }
                );
        }