I there a way to find or highlight all GameObject’s that are marked with “Navigation Static” or “Batching Static” in the Hierarchy?
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]
Until then, if you have access to internal API you can add the following extensions:
[SearchSelector("static", provider: "scene")]
[System.ComponentModel.Description("Static States")]
public static object SelectObjectStaticStates(SearchItem item)
{
var go = item.ToObject<GameObject>();
if (!go)
return (StaticEditorFlags)0;
return GameObjectUtility.GetStaticEditorFlags(go);
}
[SceneQueryEngineFilter("static")]
[System.ComponentModel.Description("Static States")]
public static StaticEditorFlags FilterObjectStaticStates(GameObject go)
{
return GameObjectUtility.GetStaticEditorFlags(go);
}
The SearchSelector
allow you to add new columns in search table view:
The SceneQueryEngineFilter
is what makes static:<enumvalue>
yield results on comparaison. SceneQueryEngineFilter
is already available through the public API, but not SearchSelector
.
Note that static:[batchingstatic, navigationstatic]
is a search expression with is equivalent to (static:batchingstatic AND static:navigationstatic)
, the [...]
is spreaded to the static
filter.
See Search Expressions · Unity-Technologies/com.unity.search.extensions Wiki · GitHub for more info on search expression query language.
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.
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
.
You can always save your queries as asset and use the inspector or property editor to preview those list and interact there:
If you feel a little bold, you can also try Search Collection from GitHub - Unity-Technologies/com.unity.search.extensions: This package contains a bunch of examples, samples and queries to be used with Unity Search.. These list can be automatically refreshed when the scene content changes, etc.
You can also do the same with a regular Editor Window if you prefer