How can we see the bounded scripts to gameobjects ? In a large project, it's hard to keep up monitoring by clicking each game object to see bounded scripts

  • 1
    \$\begingroup\$ How exactly do you want to monitor the scripts? If the built in inspector isn't cutting it, be specific about how you do want it to work. \$\endgroup\$ – MichaelHouse Mar 7 '14 at 14:47
  • \$\begingroup\$ For example I have ObstacleTrigger.cs and i bind the script to couple of game objects (obstacle types). I want to see overview of where ObstacleTrigger script is bound to. (list of which elements consist of this script) \$\endgroup\$ – Melih Mar 7 '14 at 17:06

If you want to see all the objects that are using a specific script, there are a few ways you can do that.

  • Iterate through all the game objects and return a list at will. You can find all the objects of a certain type with:

(Where myComponent is the type of component you're interested in:

myComponent[] myComponents = FindObjectsOfType(typeof(myComponent)) as myComponent[];
Debug.Log("myComponent is attached to the following game objects: ");
foreach (myComponent comp in myComponents) {
  • Create a script registry. Create a static class that contains a dictionary of scripts and their objects. For example:

Code to attach to some kind of scene object:

public static Dictionary<string, List<GameObject>> gameObjectsByScript 
    = new Dictionary<string, List<GameObject>>();

public void AddScript(string scriptName, GameObject gameObject) {

        gameObjectsByScript.Add(scriptName, new List<GameObject>());


public List<GameObject> GetGameObjectsForScript(string scriptName) {
        return gameObjectsByScript[scriptName];
        return null;

Then, in all the script Start functions you can add:

ScriptList.AddScript(this.GetType().Name, this.gameObject);

How you display the results is up to your personal preference. Maybe you want to just list them in the debug window, or you want to draw boxes around them, or whatever.

  • \$\begingroup\$ This is very cool answer. Thanks. But so according to answer, i see that Unity does not have built-in tool to monitor.. \$\endgroup\$ – Melih Mar 8 '14 at 10:00
  • \$\begingroup\$ The built in tool is the inspector. Which objects are using a particular script generally isn't something people need to look up. Glad the answer was useful. \$\endgroup\$ – MichaelHouse Mar 8 '14 at 14:58

You can also right-click on a script in the Project view, choose "Find References in Scene", and it will give you a list of all GameObjects that use that Script in the Hierarchy view.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.