In the Unity Editor, how do I find prefabs containing a specific component?

I want to find all prefabs in the project that contain a specific Component?

I only need this in-editor; no need at runtime.

If they are in added to the Scene, I can right-click and Find References in Scene. However, this is entirely unhelpful since I have a lot of prefabs in the project which aren't added to the Scene and I'd need to search those too…

• When editing in the future, instead of adding "edit" or "clarification" subheadings, just delete the unclear part and replace it with a clearer explanation. This leaves the question much clearer. (I fixed it this time.)
– Anko
Aug 9, 2015 at 19:04
• This is a very popular gripe with Unity 5. They haven't seemed to work this out yet for themselves either, but at the rate its been brought up, it should be a high priority feature request. Aug 10, 2015 at 14:11

Type this in the Project search bar and replace "MyBehaviour.cs" with the file name of your Component:

ref:Scripts/MyBehaviour.cs


WARNING: This search is slow, so it can take a very long time to find all of the objects. Be prepared to wait several seconds, minutes, perhaps even hours if you have a huge amount of prefabs.

LVBen is right, but there's another way that can be faster if you use the command line.

If Unity is set to store assets as text with metadata in .meta files, each script has a corresponding .meta file. At the top of this file is a GUID. Every scene/prefab/material/whatever that references that script contains that GUID somewhere in its text, so a full text search of assets will find all the objects that script is attached to.

This trick also works for other types, like textures and audio clips--it will find where they are linked in a serialized script field. You can make the search faster by narrowing it down to the specific file type you're interested in--for instance, only search *.prefab and ignore scene files.

Note: I've occasionally seen this trick fail. Somehow Unity left old GUID text referring to scripts that had already been removed. Still, it's a big time safer if you're comfortable quickly finding files, seeing the contents, and doing full text searches through your project.