Searching for all Prefabs that contain an Object with a Component

Looking for some guidance on how to properly construct the Search String that will find the following:

  • All Prefabs which contain a game object in their hierarchy that has a ParticleSystem component and is in the Unsorted directory.

I can find all prefabs that have a child prefab with Particle System.

I can find all prefabs that are root prefabs in the Unsorted directory

However, I cannot seem to get a valid return for the union of the two searches.

Any Guidance @sebastienp_unity? Thanks in advance!

Hi @jtigner-scpl

This is a good question. The query you are writing make sense to me.

First here are some info: we are computing the is:child, is:root using a function similar to this one:

[MenuItem("Tools/Print Prefab Info", priority = 13000)]
static void PrintPrefabInfo()
{
    if (!Selection.activeGameObject)
        return;

    var go = Selection.activeGameObject;
    Debug.Log($"is:child {go.transform.root != go.transform}");
    Debug.Log($"is:root {go.transform.root == go.transform}");
    Debug.Log($"is:leaf {go.transform.childCount == 0}");
}

For is:leaf and and is:root to be properly indexed for prefab, your index settings options must contain Sub Objects

dir:<> is indexed for top level asset/prefab.

In order to help with debugging this issue I would like to know:

  • Which version of Unity are you using?
  • Can you share your project or a smaller project with a similar setup in which this issue is happening?

We are in the process of simplifying indexation configuration. I hope these issues wil be a thing of the past.

Seb