Class SearchUtils | Quick Search | 2.0.0
docs.unity3d.com
    Show / Hide Table of Contents

    Class SearchUtils

    Utilities used by multiple components of QuickSearch.

    Inheritance
    Object
    SearchUtils
    Namespace: Unity.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
    Type Description
    Char[]

    Methods

    FetchGameObjects()

    Utility function to fetch all the game objects for the current stage (i.e. scene or prefab)

    Declaration
    public static GameObject[] FetchGameObjects()
    Returns
    Type Description
    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.

    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[]

    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.

    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.

    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.

    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.

    SelectMultipleItems(IEnumerable<SearchItem>, Boolean)

    Select and ping multiple objects in the Project Browser.

    Declaration
    public static void SelectMultipleItems(IEnumerable<SearchItem> items, bool focusProjectBrowser = false)
    Parameters
    Type Name Description
    IEnumerable<SearchItem> items

    Search Items to select and ping.

    Boolean focusProjectBrowser

    If true, will focus the project browser before pining the objects.

    SplitCamelCase(String)

    Tokenize a string each Capital letter.

    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, 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, char[] entrySeparators)
    Parameters
    Type Name Description
    String path
    Char[] entrySeparators
    Returns
    Type Description
    IEnumerable<String>

    Returns list of tokens and variations in lowercase

    Back to top
    Copyright © 2023 Unity Technologies — Terms of use
    • Legal
    • Privacy Policy
    • Cookies
    • Do Not Sell or Share My Personal Information
    • Your Privacy Choices (Cookie Settings)
    "Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
    Generated by DocFX on 18 October 2023