public SearchResultProperty(SerializedProperty p, string sRep, SearchJob job) { strRep = sRep; pathInfo = PathInfo.GetPathInfo(p, job.assetData); }
public override void SearchGameObject(SearchJob job, SearchItem item, GameObject go) { //Make sure we don't attempt to search for ScriptableObjects in GameObjects, but allow null search. if (searchValue.isDirectory || typeof(Component).IsAssignableFrom(type) || type == null) { Component[] components = null; if (searchValue.isDirectory || type == null) { components = go.GetComponents <Component>(); } else { components = go.GetComponents(type); } foreach (Component c in components) { if (c == null) { if (type == null) { SearchResult result = new SearchResult(); result.pathInfo = PathInfo.InitWithComponent(c, go, job.assetData); result.strRep = "Missing Component"; result.actionTaken = SearchAction.Found; job.MatchFound(result, item); } else { } continue; } Type cType = c.GetType(); //The above GetComponents Calls will include inherited children. if (typeMatches(cType)) { if (!showUnusedScripts) { if (matchAssetMissingScript) { assetMissingScript = false; } else { SearchResult result = new SearchResult(); result.pathInfo = PathInfo.InitWithComponent(c, go, job.assetData); result.strRep = cType.Name; result.actionTaken = SearchAction.Found; if (PrefabUtil.isInPrefabInstance(c)) { //Don't modify monoscripts in prefabs!!! } else { if (job.options.searchType == SearchType.SearchAndReplace) { SerializedObject so = new SerializedObject(c); SerializedProperty m_Script = so.FindProperty("m_Script"); if (replaceItem != null) { replaceItem.ReplaceProperty(job, m_Script, result); } } } job.MatchFound(result, item); } } } } } }