private void EditRefer(UFileInfo info) { void ClearConsoleLog() { var consoleWindowInst = ReflectionUtil.GetEditorWindow("UnityEditor.ConsoleWindow"); ReflectionUtil.CallStatic("UnityEditor.LogEntries", "Clear"); consoleWindowInst.Call("DoLogChanged"); } ClearConsoleLog(); switch (info.extension) { case ".prefab": { var stage = PrefabStageUtility.GetCurrentPrefabStage(); if (stage == null || stage.prefabContentsRoot.name != info.fileName) { AssetDatabase.OpenAsset(info.asset); stage = PrefabStageUtility.GetCurrentPrefabStage(); } var root = stage.prefabContentsRoot; if (root) { var refObj = GetRefObj(info); HighlightUtil.HighlightRefer( root, refObj, true, findThingType ); } break; } case ".unity": { var path = UToolsUtil.AssetRelativePath(info.relativePath); var scene = SceneManager.GetSceneByPath(path); if (!scene.IsValid()) { var index = EditorUtility.DisplayDialogComplex( "Warning", $"How to open this scene {info.fileName} ?", "Cancel", "SingleOpen", "Additive" ); switch (index) { case 0: break; case 1: scene = EditorSceneManager.OpenScene( path, OpenSceneMode.Single ); break; case 2: scene = EditorSceneManager.OpenScene( path, OpenSceneMode.Additive ); break; } if (!scene.isLoaded) { scene = EditorSceneManager.OpenScene(path, OpenSceneMode.Additive); } } if (scene.IsValid()) { var refObj = GetRefObj(info); HighlightUtil.HighlightRefer( scene, refObj, true, findThingType ); } break; } } }