Search Unity

Question Quick Search: How to find GameObject(s) with "Navigation Static" or "Batching Static" ?

Discussion in 'Editor Workflows' started by Peter77, Sep 2, 2021.

  1. Peter77

    Peter77

    QA Jesus

    Joined:
    Jun 12, 2013
    Posts:
    6,609
    I there a way to find or highlight all GameObject's that are marked with "Navigation Static" or "Batching Static" in the Hierarchy?
     
  2. jonathans42

    jonathans42

    Unity Technologies

    Joined:
    Jan 25, 2018
    Posts:
    514
    I will add in the next version a way to yield specific static states, right now you can only use
    h: is:static
    .

    In the new version you will be able to do this:

    h: t:MeshRenderer static:[batchingstatic, navigationstatic]


    upload_2021-10-18_12-12-51.png

    Until then, if you have access to internal API you can add the following extensions:

    Code (CSharp):
    1.  
    2. [SearchSelector("static", provider: "scene")]
    3. [System.ComponentModel.Description("Static States")]
    4. public static object SelectObjectStaticStates(SearchItem item)
    5. {
    6.     var go = item.ToObject<GameObject>();
    7.     if (!go)
    8.         return (StaticEditorFlags)0;
    9.     return GameObjectUtility.GetStaticEditorFlags(go);
    10. }
    11.  
    12. [SceneQueryEngineFilter("static")]
    13. [System.ComponentModel.Description("Static States")]
    14. public static StaticEditorFlags FilterObjectStaticStates(GameObject go)
    15. {
    16.     return GameObjectUtility.GetStaticEditorFlags(go);
    17. }
    18.  
    The
    SearchSelector
    allow you to add new columns in search table view:

    upload_2021-10-18_12-15-26.png

    The
    SceneQueryEngineFilter
    is what makes
    static:<enumvalue>
    yield results on comparaison.
    SceneQueryEngineFilter
    is already available through the public API, but not
    SearchSelector
    .
     
    Peter77 likes this.
  3. jonathans42

    jonathans42

    Unity Technologies

    Joined:
    Jan 25, 2018
    Posts:
    514
  4. Peter77

    Peter77

    QA Jesus

    Joined:
    Jun 12, 2013
    Posts:
    6,609
    Thank you for the reply.

    Will this also highlight those GameObjects (their meshes) in the Scene View? For example, when I search for "Navigation Static" I would like the Scene View to render "Navigation Static" GameObjects normally, but all others, that don't match the search, should be rendered grayed-out.

    This would allow to easily see in the level if a static flag is missing for a particular object, without having to crawl lists.
     
  5. jonathans42

    jonathans42

    Unity Technologies

    Joined:
    Jan 25, 2018
    Posts:
    514
    Only if you use the Advanced Search Engine for the Scene Search and if you type that same query in the Hierarchy search field. You can set this in the
    Edit > Preferences... > Search
    .

    upload_2021-10-18_13-1-40.png

    upload_2021-10-18_13-7-52.png

    You can always save your queries as asset and use the inspector or property editor to preview those list and interact there:

    upload_2021-10-18_13-9-14.png

    upload_2021-10-18_13-11-10.png
     
    Peter77 likes this.
  6. jonathans42

    jonathans42

    Unity Technologies

    Joined:
    Jan 25, 2018
    Posts:
    514