Skip to content

Instantly share code, notes, and snippets.

@kamyker
Last active December 4, 2020 02:26
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kamyker/9aea531fa3ee5083da869001df5a0ddf to your computer and use it in GitHub Desktop.
Save kamyker/9aea531fa3ee5083da869001df5a0ddf to your computer and use it in GitHub Desktop.
Unity Find References In Project with Quick Search
using Unity.QuickSearch;
using UnityEditor;
public static class FindReferencesInProjectEditor
{
static ISearchView searchView;
[MenuItem( "Assets/Find References In Project", priority = 29 )]
static void FindReferencesInProject()
{
var searchText = $"ref:\"{Selection.activeObject.name}\"";
var context = new SearchContext(SearchService.Providers, searchText);
if ( searchView == null || searchView.context == null )
searchView = SearchService.ShowWindow( context );
searchView.SetSearchText( searchText );
}
}
@kamyker
Copy link
Author

kamyker commented Oct 11, 2020

Adds Find References In Project:
image

Make sure to check Dependencies in settings:
image

Thanks to https://github.com/jschmidt42 for the help :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment