Created
August 8, 2018 09:53
-
-
Save karljj1/f6f9e03dca9d578701cfd75ba4e21d94 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[MenuItem("CONTEXT/Component/Find References In Scene")] | |
private static void OnSearchForReferencesToComponent(MenuCommand command) | |
{ | |
var component = command.context as Component; | |
if (component) | |
{ | |
var searchFilter = "ref:" + component.GetInstanceID() + ":"; | |
foreach (SearchableEditorWindow sw in searchableWindows) | |
{ | |
if (sw.m_HierarchyType == HierarchyType.GameObjects) | |
{ | |
sw.SetSearchFilter(searchFilter, SearchMode.All, false, false); | |
sw.m_HasSearchFilterFocus = true; | |
sw.Repaint(); | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Via reflection
var view = SceneView.currentDrawingSceneView;
MethodInfo setSearchType = typeof(SearchableEditorWindow).GetMethod("SetSearchFilter", BindingFlags.NonPublic | BindingFlags.Instance);
bool setAll = false;
bool delayed = false;
setSearchType.Invoke(view, new object[] {"search filter", SearchableEditorWindow.SearchMode.All, setAll, delayed });