void OnGuiInitSetting() { srcAsset = EditorGUILayout.ObjectField("from", srcAsset, typeof(Object), true); GUILayout.Label(string.IsNullOrEmpty(this.dictionaryPath) ? "Project Dictionary" : this.dictionaryPath); if (GUILayout.Button("Select", GUILayout.Width(100))) { string convertPath = this.dictionaryPath; string dir = string.IsNullOrEmpty(convertPath) ? "" : Path.GetDirectoryName(convertPath); string name = string.IsNullOrEmpty(convertPath) ? "" : Path.GetFileName(convertPath); string path = EditorUtility.SaveFolderPanel("Select folder", dir, name); if (!string.IsNullOrEmpty(path)) { this.dictionaryPath = path; } } EditorGUI.BeginDisabledGroup(srcAsset == null); if (GUILayout.Button("Find", GUILayout.Width(100))) { refereceInfoList.Clear(); foreach (Component component in UtageEditorToolKit.FindReferencesComponentsInScene(srcAsset)) { refereceInfoList.Add(new RefereceInfo(component)); } foreach (Object obj in UtageEditorToolKit.FindReferencesAssetsInProject(dictionaryPath, srcAsset)) { refereceInfoList.Add(new RefereceInfo(obj)); } mode = Mode.ChangeSetting; } EditorGUI.EndDisabledGroup(); }
public static List <Object> FindReferences(Object srcAsset, string dictionaryPath) { List <Object> list = new List <Object>(); UtageEditorToolKit.FindReferencesComponentsInScene(srcAsset).ForEach(x => list.Add(x)); list.AddRange(UtageEditorToolKit.FindReferencesAssetsInProject(dictionaryPath, srcAsset)); return(list); }