Class SearchUtils
Utilities used by multiple components of QuickSearch.
Syntax
public static class SearchUtils
Fields
entrySeparators
Separators used to split an entry into indexable tokens.
Declaration
public static readonly char[] entrySeparators
Field Value
Methods
CreateGroupProvider(SearchProvider, String, Int32, Boolean)
Declaration
public static SearchProvider CreateGroupProvider(SearchProvider templateProvider, string groupId, int groupPriority, bool cacheProvider = false)
Parameters
Returns
CreateQuery(in String, SearchContext, SearchTable)
Declaration
public static ISearchQuery CreateQuery(in string name, SearchContext context, SearchTable tableConfig)
Parameters
Returns
CreateSceneResult(SearchContext, SearchProvider, GameObject)
Declaration
public static SearchItem CreateSceneResult(SearchContext context, SearchProvider sceneProvider, GameObject go)
Parameters
Returns
EnumerateAllQueries()
Declaration
public static IEnumerable<ISearchQuery> EnumerateAllQueries()
Returns
FetchGameObjects()
Utility function to fetch all the game objects for the current stage (i.e. scene or prefab)
Declaration
public static IEnumerable<GameObject> FetchGameObjects()
Returns
FetchGameObjects(Scene)
Utility function to fetch all the game objects in a particular scene.
Declaration
public static GameObject[] FetchGameObjects(Scene scene)
Parameters
Type |
Name |
Description |
Scene |
scene |
Scene to get objects from.
|
Returns
Type |
Description |
GameObject[] |
The array of game objects in the scene.
|
FindQuery(String)
Declaration
public static ISearchQuery FindQuery(string guid)
Parameters
Type |
Name |
Description |
String |
guid |
|
Returns
FindShiftLeftVariations(String)
Extract all variations on a word.
Declaration
public static string[] FindShiftLeftVariations(string word)
Parameters
Type |
Name |
Description |
String |
word |
|
Returns
Declaration
public static string FormatBytes(long byteCount)
Parameters
Type |
Name |
Description |
Int64 |
byteCount |
|
Returns
Declaration
public static string FormatCount(ulong count)
Parameters
Type |
Name |
Description |
UInt64 |
count |
|
Returns
FrameAssetFromPath(String)
Declaration
public static void FrameAssetFromPath(string path)
Parameters
Type |
Name |
Description |
String |
path |
|
GetAssetPath(in SearchItem)
Declaration
public static string GetAssetPath(in SearchItem item)
Parameters
Returns
GetAssetPreviewFromPath(String, FetchPreviewOptions)
Declaration
public static Texture2D GetAssetPreviewFromPath(string path, FetchPreviewOptions previewOptions)
Parameters
Returns
GetAssetPreviewFromPath(String, Vector2, FetchPreviewOptions)
Declaration
public static Texture2D GetAssetPreviewFromPath(string path, Vector2 previewSize, FetchPreviewOptions previewOptions)
Parameters
Returns
GetAssetThumbnailFromPath(String)
Declaration
public static Texture2D GetAssetThumbnailFromPath(string path)
Parameters
Type |
Name |
Description |
String |
path |
|
Returns
GetHierarchyAssetPath(GameObject, Boolean)
Get the path of the scene (or prefab) containing a GameObject.
Declaration
public static string GetHierarchyAssetPath(GameObject gameObject, bool prefabOnly = false)
Parameters
Type |
Name |
Description |
GameObject |
gameObject |
GameObject to find the scene path.
|
Boolean |
prefabOnly |
If true, will return a path only if the GameObject is a prefab.
|
Returns
Type |
Description |
String |
Returns the path of a scene or prefab
|
GetHierarchyPath(GameObject, Boolean)
Get the hierarchy path of a GameObject possibly including the scene name.
Declaration
public static string GetHierarchyPath(GameObject gameObject, bool includeScene = true)
Parameters
Type |
Name |
Description |
GameObject |
gameObject |
GameObject to extract a path from.
|
Boolean |
includeScene |
If true, will append the scene name to the path.
|
Returns
Type |
Description |
String |
Returns the path of a GameObject.
|
GetMainAssetInstanceID(String)
Declaration
public static int GetMainAssetInstanceID(string assetPath)
Parameters
Type |
Name |
Description |
String |
assetPath |
|
Returns
GetMainWindowCenteredPosition(Vector2)
Declaration
public static Rect GetMainWindowCenteredPosition(Vector2 size)
Parameters
Returns
GetObjectPath(Object)
Declaration
public static string GetObjectPath(Object obj)
Parameters
Type |
Name |
Description |
Object |
obj |
|
Returns
Type |
Description |
String |
Returns the path of an object.
|
GetSceneObjectPreview(GameObject, Vector2, FetchPreviewOptions, Texture2D)
Declaration
public static Texture2D GetSceneObjectPreview(GameObject obj, Vector2 size, FetchPreviewOptions options, Texture2D thumbnail)
Parameters
Returns
Format the pretty name of a Transform component by appending all the parents hierarchy names.
Declaration
public static string GetTransformPath(Transform tform)
Parameters
Type |
Name |
Description |
Transform |
tform |
Transform to extract name from.
|
Returns
Type |
Description |
String |
Returns a transform name using "/" as hierarchy separator.
|
GetTypeIcon(in Type)
Declaration
public static Texture2D GetTypeIcon(in Type type)
Parameters
Type |
Name |
Description |
Type |
type |
|
Returns
MatchSearchGroups(SearchContext, String, Boolean)
Helper function to match a string against the SearchContext. This will try to match the search query against each tokens of content (similar to the AddComponent menu workflow)
Declaration
public static bool MatchSearchGroups(SearchContext context, string content, bool ignoreCase = false)
Parameters
Type |
Name |
Description |
SearchContext |
context |
Search context containing the searchQuery that we try to match.
|
String |
content |
String content that will be tokenized and use to match the search query.
|
Boolean |
ignoreCase |
Perform matching ignoring casing.
|
Returns
Type |
Description |
Boolean |
Has a match occurred.
|
OpenQuery(ISearchQuery, SearchFlags)
Declaration
public static ISearchView OpenQuery(ISearchQuery sq, SearchFlags flags)
Parameters
Returns
PingAsset(String)
Declaration
public static void PingAsset(string assetPath)
Parameters
Type |
Name |
Description |
String |
assetPath |
|
SelectMultipleItems(IEnumerable<SearchItem>, Boolean, Boolean)
Select and ping multiple objects in the Project Browser.
Declaration
public static void SelectMultipleItems(IEnumerable<SearchItem> items, bool focusProjectBrowser = false, bool pingSelection = true)
Parameters
Type |
Name |
Description |
IEnumerable<SearchItem> |
items |
Search Items to select and ping.
|
Boolean |
focusProjectBrowser |
If true, will focus the project browser before pinging the objects.
|
Boolean |
pingSelection |
If true, will ping the selected objects.
|
ShowColumnEditor(MultiColumnHeaderState.Column, Action<MultiColumnHeaderState.Column>)
Declaration
public static EditorWindow ShowColumnEditor(MultiColumnHeaderState.Column column, Action<MultiColumnHeaderState.Column> editHandler)
Parameters
Returns
ShowColumnSelector(Action<IEnumerable<SearchColumn>, Int32>, IEnumerable<SearchColumn>, Vector2, Int32)
Declaration
public static void ShowColumnSelector(Action<IEnumerable<SearchColumn>, int> columnsAddedHandler, IEnumerable<SearchColumn> columns, Vector2 mousePosition, int activeColumnIndex)
Parameters
ShowIconPicker(Action<Texture2D, Boolean>)
Declaration
public static void ShowIconPicker(Action<Texture2D, bool> iconSelectedHandler)
Parameters
SplitCamelCase(String)
Declaration
public static string[] SplitCamelCase(string source)
Parameters
Type |
Name |
Description |
String |
source |
|
Returns
SplitEntryComponents(String, Char[])
Split an entry according to a specified list of separators.
Declaration
public static IEnumerable<string> SplitEntryComponents(string entry, char[] entrySeparators)
Parameters
Type |
Name |
Description |
String |
entry |
Entry to split.
|
Char[] |
entrySeparators |
List of separators that indicate split points.
|
Returns
SplitFileEntryComponents(String, in Char[])
Split a file entry according to a list of separators and find all the variations on the entry name.
Declaration
public static IEnumerable<string> SplitFileEntryComponents(string path, in char[] entrySeparators)
Parameters
Type |
Name |
Description |
String |
path |
|
Char[] |
entrySeparators |
|
Returns
Type |
Description |
IEnumerable<String> |
Returns list of tokens and variations in lowercase
|
StartDrag(Object[], String)
Declaration
public static void StartDrag(Object[] objects, string label = null)
Parameters
StartDrag(Object[], String[], String)
Declaration
public static void StartDrag(Object[] objects, string[] paths, string label = null)
Parameters
TryParse<T>(String, out T)
Declaration
public static bool TryParse<T>(string expression, out T result)
Parameters
Type |
Name |
Description |
String |
expression |
|
T |
result |
|
Returns
Type Parameters
Did you find this page useful? Please give it a rating:
Thanks for rating this page!
What kind of problem would you like to report?
Thanks for letting us know! This page has been marked for review based on your feedback.
If you have time, you can provide more information to help us fix the problem faster.
Provide more information
You've told us this page needs code samples. If you'd like to help us further, you could provide a code sample, or tell us about what kind of code sample you'd like to see:
You've told us there are code samples on this page which don't work. If you know how to fix it, or have something better we could use instead, please let us know:
You've told us there is information missing from this page. Please tell us more about what's missing:
You've told us there is incorrect information on this page. If you know what we should change to make it correct, please tell us:
You've told us this page has unclear or confusing information. Please tell us more about what you found unclear or confusing, or let us know how we could make it clearer:
You've told us there is a spelling or grammar error on this page. Please tell us what's wrong:
You've told us this page has a problem. Please tell us more about what's wrong:
Thank you for helping to make the Unity documentation better!
Your feedback has been submitted as a ticket for our documentation team to review.
We are not able to reply to every ticket submitted.