Version: 2021.1
  • C#



Suggest a change


Thank you for helping us improve the quality of Unity Documentation. Although we cannot accept all submissions, we do read each suggested change from our users and will make updates where applicable.


Submission failed

For some reason your suggested change could not be submitted. Please <a>try again</a> in a few minutes. And thank you for taking the time to help us improve the quality of Unity Documentation.




An enumeration that contains the available search engine scopes.

A search engine scope identifies where a search comes from. This is useful when implementing a single entry point for the base engine functions:

using System;
using System.Collections.Generic;
using System.Linq;
using UnityEditor;
using UnityEditor.SearchService;
using UnityEngine;
using Object = UnityEngine.Object;

class BaseEngine : ISearchEngineBase { public virtual void BeginSession(ISearchContext context) { if (context.engineScope == ObjectSelector.EngineScope || context.engineScope == Project.EngineScope) { // Cache Assets. } if (context.engineScope == ObjectSelector.EngineScope || context.engineScope == Scene.EngineScope) { // Cache Scene objects. } }

public virtual void EndSession(ISearchContext context) { // Flush any cached data. }

public virtual void BeginSearch(ISearchContext context, string query) { }

public virtual void EndSearch(ISearchContext context) { }

public string name => "My Engine Service"; }

[SceneSearchEngine] class SceneFilterEngine : BaseEngine, ISceneSearchEngine { public bool Filter(ISearchContext context, string query, HierarchyProperty objectToFilter) { // Use cached Scene objects. // ... return true; } }

[ProjectSearchEngine] class ProjectSearchEngine : BaseEngine, IProjectSearchEngine { public IEnumerable<string> Search(ISearchContext context, string query, Action<IEnumerable<string>> asyncItemsReceived) { // Use cached Assets. // ... return new List<string>(); } }

[ObjectSelectorEngine] class ObjectSelectorEngine : BaseEngine, IObjectSelectorEngine { public bool SelectObject(ISearchContext context, Action<Object, bool> onObjectSelectorClosed, Action<Object> onObjectSelectedUpdated) { // Use cached Assets and Scene objects. return true; }

public void SetSearchFilter(ISearchContext context, string searchFilter) {} }


SceneIdentifies a search for Scene engines.
ProjectIdentifies a search for Project engines.
ObjectSelectorIdentifies a search for ObjectSelector engines.