internal static void HighlightRefer( GameObject referRoot, object refObj, bool logInfo, FindThingType mode ) { results.Clear(); UToolsUtil.RecursiveObjs( v => { FindRefInGameObject(v, refObj, referRoot.transform, null, mode); }, referRoot ); HighlightFirstResult(); if (logInfo) { LogResult(); } }
internal static void HighlightRefer( Scene referScene, object refObj, bool logInfo, FindThingType mode ) { results.Clear(); var rootGOS = referScene.GetRootGameObjects(); UToolsUtil.RecursiveObjs( v => { FindRefInGameObject(v, refObj, null, referScene.name, mode); }, rootGOS ); HighlightFirstResult(); if (logInfo) { LogResult(); } }
private void OnGUI() { if (DrawWorking(guidMapGen)) { return; } findThingType = UTGUI.EnumToolbar(findThingType); EditorGUILayout.BeginVertical("box"); scrollerPos = EditorGUILayout.BeginScrollView(scrollerPos); switch (findThingType) { case FindThingType.Assets: DrawFindAssetView(); break; case FindThingType.CustomStr: DrawFindStrView(); break; case FindThingType.BuiltinComponent: DrawFindBuiltinComponentView(); break; } EditorGUILayout.EndScrollView(); EditorGUILayout.EndVertical(); GUILayout.BeginVertical(); GUILayout.FlexibleSpace(); DrawOptionsView(); GUILayout.EndVertical(); }
internal static void FindRefInGameObject( GameObject referObj, object refObj, Transform referRoot, string referSceneName, FindThingType mode ) { var comps = referObj.GetComponents <Component>(); for (var i = 0; i < comps.Length; i++) { var m = comps[i]; if (m == null) { Debug.LogWarning($"{referObj} has a missing Component", referObj); continue; } FindRefInComponent(m, refObj, referRoot, referSceneName); } if (mode == FindThingType.CustomStr) { var referObjName = referObj.name; var refObjStr = refObj.ToString(); if (referObjName == refObjStr || referObjName.Contains(refObjStr)) { var result = new Result(); result.type = ReferType.RefByObjectName; result.refObj = refObj; result.referSceneName = referSceneName; result.referRoot = referRoot; result.referObj = referObj; results.Add(result); } } if (refObj is GameObject) { var isPrefabInstance = UToolsUtil.IsPrefabInstance(referObj); if (isPrefabInstance) { var root = PrefabUtility.GetOutermostPrefabInstanceRoot(referObj); if (root != referObj) { return; } var prefabParent = PrefabUtility.GetCorrespondingObjectFromSource(referObj); if (prefabParent == (GameObject)refObj) { var result = new Result(); result.type = ReferType.RefByPrefabInst; result.refObj = refObj; result.referSceneName = referSceneName; result.referRoot = referRoot; result.referObj = referObj; results.Add(result); } } } }