How do I find prefab in the project that references a specific asset by Editor search query?

Hi,
I want to find all prefabs that references Assets/MyAsset/FooBar.asset.
I know that I can find all prefabs by select{ p: *.prefab, @path }, and find the references by ref="Assets/MyAsset/FooBar.asset".
However, there are 2 problems:

  1. I don’t know how to combine those query snippets
  2. The latter snippet does not yield result for refenreces from prefab in the project

How can I perform such query? Thanks.

Hi @hika17 ,

Sorry or the long delay in answering your question. Tracking Search questions is now easier than ever using the tag system, so I should get more responsive.

Your query can be expressed withou using as select:

ref="Assets/MyAsset/FooBar.asset" t:prefab

This will find all assets referencing Assets/MyAsset/FooBar.asset and then yields only the assets that are actual prefab.

Note: there is no prefab type per se, but we have created t:prefab to solve this use case more relegantly.

I have marked this thread as resolved. @hika17 feel free to unresolved it if you feel the answer is not satisfactory.

1 Like