public override void Update()
        {
            var files = FindDependencies.FilesThatReference(Target);

            Dependencies = Group(files.Where(f => !(f.Target is SceneAsset)))
                           .OrderBy(t => t.LabelContent.text, StringComparer.Ordinal)
                           .ToArray();
//            ScenePaths = FindDependencies.ScenesThatContain(Target.Target).Select(p => new Pair { Path = p, NicifiedPath = p.Replace("Assets/", string.Empty) }).ToArray();
        }
예제 #2
0
 public override void Update()
 {
     Dependencies = Group(FindDependencies.InScenePro(Target)).ToArray();
 }
예제 #3
0
        private void ShowDependencies(ResultRow[] dependencies)
        {
            _expandFiles = EditorGUILayout.Foldout(_expandFiles, _fileMode ? FileDependencies : SceneDependencies);
            if (!_fileMode)
            {
                if (_data.Target.Scene.IsValid() && !_data.Target.Scene.isLoaded)
                {
                    return;
                }
            }
            if (_expandFiles)
            {
                if (dependencies.Any())
                {
                    foreach (var dependency in dependencies)
                    {
                        DrawRow(dependency);
                    }
                }
                else
                {
                    EditorGUILayout.LabelField("No file dependencies found.");
                }
            }
            EditorGUILayout.Space();

            var fileDep = _data as FileDependency;

            if (fileDep == null)
            {
                return;
            }

            if (fileDep.ScenePaths == null)
            {
                if (GUILayout.Button("Search Scenes"))
                {
                    fileDep.ScenePaths = FindDependencies.ScenesThatContain(_data.Target.Target).Select(p => new FileDependency.Pair {
                        Path = p, NicifiedPath = p.Replace("Assets/", string.Empty)
                    }).ToArray();
                }
                return;
            }

            _expandScenes = EditorGUILayout.Foldout(_expandScenes, "Scenes:");

            if (!_expandScenes)
            {
                return;
            }

            if (!fileDep.ScenePaths.Any())
            {
                EditorGUILayout.LabelField("No scene dependencies found.");
                return;
            }

            for (int i = 0; i < fileDep.ScenePaths.Length; i++)
            {
                var p = fileDep.ScenePaths[i];
                using (new EditorGUILayout.HorizontalScope())
                {
                    SceneIcon.text = p.NicifiedPath;

                    if (GUILayout.Button(SceneIcon, EditorStyles.label, GUILayout.Height(16f)))
                    {
                        Selection.activeObject = AssetDatabase.LoadAssetAtPath <SceneAsset>(p.Path);
                    }

                    if (!GUILayout.Button("Open scene & search", GUILayout.Width(200f)))
                    {
                        continue;
                    }

                    var s = SceneManager.GetSceneByPath(p.Path);
                    if (s.isLoaded)
                    {
                        InitSceneWindow(_data.Target.Target, p.Path);
                    }
                    else
                    {
                        if (s.isDirty && !EditorUtility.DisplayDialog("Unsaved Scene", "You have unsaved shanges in scene", "Discard scene", "Cancel search"))
                        {
                            return;
                        }

                        EditorSceneManager.OpenScene(p.Path);
                        EditorSceneExtensions.FireOnSceneOpenAndForget(() => InitSceneWindow(_data.Target.Target, p.Path));
                    }
                }
            }
        }