To add a new Search Provider, create a function and tag it with the SearchItemProvider
attribute, as in the following example:
[SearchItemProvider]
internal static SearchProvider CreateProvider()
{
return new SearchProvider(type, displayName)
{
filterId = "me:",
fetchItems = (context, items, provider) =>
{
var itemNames = new List<string>();
var shortcuts = new List<string>();
GetMenuInfo(itemNames, shortcuts);
items.AddRange(itemNames.Where(menuName =>
SearchProvider.MatchSearchGroups(context.searchText, menuName))
.Select(menuName => provider.CreateItem(menuName,
Path.GetFileName(menuName), menuName)));
},
fetchThumbnail = (item, context) => Icons.shortcut
};
}
SearchProvider
instance.SearchProvider
instance must have the following:type
. For example, Asset, Menu, or SceneA Scene contains the environments and menus of your game. Think of each unique Scene file as a unique level. In each Scene, you place your environments, obstacles, and decorations, essentially designing and building your game in pieces. More infodisplayName
to use in the Filters pane.filterId
provides a search token for text-based filtering. For example, p:
is the filter ID for Asset searches.To register a shortcut for a new provider, use:
[UsedImplicitly, Shortcut("Help/Quick Search/Assets")]
private static void PopQuickSearch()
{
// Open Search with only the "Asset" provider enabled.
QuickSearchTool.OpenWithContextualProvider("asset");
}
You can map shortcuts to keys or key combinations using the shortcuts manager.