How to know where a particular script is being used?

Hi I created a project a while back. Now I'm opening it and I find that I've forgotten most of what I've done. I'm trying to remove a script from the game but don't remember which object/prefab I attached it to. Is there a way to see where a particular script is being used at? something like "select dependencies" but the opposite.

In the project view right click on the script and choose “Find References In Scene”.

If you know which scene it is in, just use the search field in the Hierarchy view (in Unity 3). Be sure to type the full script name, or you won't see any results.

public class FindPrefabsWithComponent : MonoBehaviour {

    public GameObject[] prefabs;

    void Start()

    private void FindPrefabsWithComponentType<T>() where T : Component
        print("Searching for components...");
        foreach (var prefab in prefabs)
            T foundComponent = prefab.GetComponentInChildren<T>();
            if (foundComponent != null)
                print("Found component in " +;
        print("search complete");

If you want to find all prefabs that the script is attached to, even ones that are not in any of your scenes, you can follow these instructions:

  1. Create the FindPrefabsWithComponent c# script above, but replace “Rigidbody” with whatever script you are wanting to find.
  2. Create a new game object in your scene and attach the FindPrefabsWithComponent script.
  3. Click the small lock icon in the top right of the inspector window to lock the inspector view onto your new game object.
  4. In your project, search for all prefabs with “t:Prefab” or by using the filter button immediately to the right of the search box in the project window.
  5. Select all of the prefabs in the project window (Ctrl-A on windows) and drag them onto “Prefabs” in the FindPrefabsWithComponent component in the inspector window.
  6. Run the game. It will print out the name of the game object that the script is attached to.