Documentation

Unity Engine

Download Unity

Unity Engine

SelectMultipleItems(IEnumerable<SearchItem>, bool, bool)

Selects the objects of multiple search items in the Project window and optionally pings the last one.
Read time 1 minuteLast updated 6 days ago

Definition

public static void SelectMultipleItems(IEnumerable<SearchItem> items, bool focusProjectBrowser = false, bool pingSelection = true)

Parameters

Search Items to select and ping.

focusProjectBrowser

Whether to focus the Project window before Unity pings the selection. The default value is false.

pingSelection

Whether to ping the last selected object. The default value is true.

Remarks

If none of the items resolves to an object, this method opens the first item with its default application.

Examples

using UnityEditor;using UnityEditor.Search;class Example_SearchUtils_SelectMultipleItems{ [MenuItem("Examples/SearchUtils/SelectMultipleItems")] public static void Run() { // Find all the scripts in the project. using var context = SearchService.CreateContext("asset", "t:MonoScript"); using var request = SearchService.Request(context, SearchFlags.Synchronous); // Select the objects of the search items in the Project window, focus the window, and ping the last selected object. SearchUtils.SelectMultipleItems(request, focusProjectBrowser: true, pingSelection: true); }}