Example #1
0
        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).ToArray();
        }
 public override void Update()
 {
     Dependencies = Group(FindDependencies.InScenePro(Target)).ToArray();
 }
Example #3
0
        private void ShowDependencies(ResultRow[] dependencies)
        {
            _expandFiles = EditorGUILayout.Foldout(_expandFiles, _fileMode ? FileDependencies : SceneDependencies);
            if (!_fileMode)
            {
                if (!_data.Target.Scene.isLoaded)
                {
                    DelayedClose();
                }
            }
            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;
                    }

                    if (SceneManager.GetSceneByPath(p.Path).isLoaded)
                    {
                        InitSceneWindow(_data.Target.Target, p.Path);
                    }
                    else
                    {
                        EditorSceneManager.OpenScene(p.Path);
                        EditorSceneExtensions.FireOnSceneOpenAndForget(() => InitSceneWindow(_data.Target.Target, p.Path));
                    }
                }
            }
        }