docs.unity.cn
    Show / Hide Table of Contents

    Class SearchUtils

    Utilities used by multiple components of QuickSearch.

    Inheritance
    Object
    SearchUtils
    Namespace: UnityEditor.Search
    Syntax
    public static class SearchUtils

    Fields

    entrySeparators

    Separators used to split an entry into indexable tokens.

    Declaration
    public static readonly char[] entrySeparators
    Field Value
    Type Description
    Char[]

    Methods

    CreateGroupProvider(SearchProvider, String, Int32, Boolean)

    Declaration
    public static SearchProvider CreateGroupProvider(SearchProvider templateProvider, string groupId, int groupPriority, bool cacheProvider = false)
    Parameters
    Type Name Description
    SearchProvider templateProvider
    String groupId
    Int32 groupPriority
    Boolean cacheProvider
    Returns
    Type Description
    SearchProvider

    CreateQuery(in String, SearchContext, SearchTable)

    Declaration
    public static ISearchQuery CreateQuery(in string name, SearchContext context, SearchTable tableConfig)
    Parameters
    Type Name Description
    String name
    SearchContext context
    SearchTable tableConfig
    Returns
    Type Description
    ISearchQuery

    CreateSceneResult(SearchContext, SearchProvider, GameObject)

    Declaration
    public static SearchItem CreateSceneResult(SearchContext context, SearchProvider sceneProvider, GameObject go)
    Parameters
    Type Name Description
    SearchContext context
    SearchProvider sceneProvider
    GameObject go
    Returns
    Type Description
    SearchItem

    EnumerateAllQueries()

    Declaration
    public static IEnumerable<ISearchQuery> EnumerateAllQueries()
    Returns
    Type Description
    IEnumerable<ISearchQuery>

    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
    Type Description
    IEnumerable<GameObject>

    The array of game objects in the current stage.

    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
    Type Description
    ISearchQuery

    FindShiftLeftVariations(String)

    Extract all variations on a word.

    Declaration
    public static string[] FindShiftLeftVariations(string word)
    Parameters
    Type Name Description
    String word
    Returns
    Type Description
    String[]

    FormatBytes(Int64)

    Declaration
    public static string FormatBytes(long byteCount)
    Parameters
    Type Name Description
    Int64 byteCount
    Returns
    Type Description
    String

    FormatCount(UInt64)

    Declaration
    public static string FormatCount(ulong count)
    Parameters
    Type Name Description
    UInt64 count
    Returns
    Type Description
    String

    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
    Type Name Description
    SearchItem item
    Returns
    Type Description
    String

    GetAssetPreviewFromPath(String, FetchPreviewOptions)

    Declaration
    public static Texture2D GetAssetPreviewFromPath(string path, FetchPreviewOptions previewOptions)
    Parameters
    Type Name Description
    String path
    FetchPreviewOptions previewOptions
    Returns
    Type Description
    Texture2D

    GetAssetPreviewFromPath(String, Vector2, FetchPreviewOptions)

    Declaration
    public static Texture2D GetAssetPreviewFromPath(string path, Vector2 previewSize, FetchPreviewOptions previewOptions)
    Parameters
    Type Name Description
    String path
    Vector2 previewSize
    FetchPreviewOptions previewOptions
    Returns
    Type Description
    Texture2D

    GetAssetThumbnailFromPath(String)

    Declaration
    public static Texture2D GetAssetThumbnailFromPath(string path)
    Parameters
    Type Name Description
    String path
    Returns
    Type Description
    Texture2D

    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
    Type Description
    Int32

    GetMainWindowCenteredPosition(Vector2)

    Declaration
    public static Rect GetMainWindowCenteredPosition(Vector2 size)
    Parameters
    Type Name Description
    Vector2 size
    Returns
    Type Description
    Rect

    GetObjectPath(Object)

    Get the path of a Unity Object. If it is a GameObject or a Component it is the GetTransformPath(Transform). Else it is the asset name.

    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
    Type Name Description
    GameObject obj
    Vector2 size
    FetchPreviewOptions options
    Texture2D thumbnail
    Returns
    Type Description
    Texture2D

    GetTransformPath(Transform)

    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
    Type Description
    Texture2D

    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
    Type Name Description
    ISearchQuery sq
    SearchFlags flags
    Returns
    Type Description
    ISearchView

    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
    Type Name Description
    MultiColumnHeaderState.Column column
    Action<MultiColumnHeaderState.Column> editHandler
    Returns
    Type Description
    EditorWindow

    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
    Type Name Description
    Action<IEnumerable<SearchColumn>, Int32> columnsAddedHandler
    IEnumerable<SearchColumn> columns
    Vector2 mousePosition
    Int32 activeColumnIndex

    ShowIconPicker(Action<Texture2D, Boolean>)

    Declaration
    public static void ShowIconPicker(Action<Texture2D, bool> iconSelectedHandler)
    Parameters
    Type Name Description
    Action<Texture2D, Boolean> iconSelectedHandler

    SplitCamelCase(String)

    Declaration
    public static string[] SplitCamelCase(string source)
    Parameters
    Type Name Description
    String source
    Returns
    Type Description
    String[]

    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
    Type Description
    IEnumerable<String>

    Returns list of tokens in lowercase

    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
    Type Name Description
    Object[] objects
    String label

    StartDrag(Object[], String[], String)

    Declaration
    public static void StartDrag(Object[] objects, string[] paths, string label = null)
    Parameters
    Type Name Description
    Object[] objects
    String[] paths
    String label

    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 Description
    Boolean
    Type Parameters
    Name Description
    T
    Back to top Copyright © 2022 Unity Technologies
    Generated by DocFX
    on Wednesday, October 26, 2022
    Terms of use