# How can I reference a specific script inside a GameObject from another MonoBehaviour.

**URL:** https://discussions.unity.com/t/how-can-i-reference-a-specific-script-inside-a-gameobject-from-another-monobehaviour/20318
**Category:** Questions & Answers
**Created:** [May 2, 2011, 8:46pm UTC](https://discussions.unity.com/t/how-can-i-reference-a-specific-script-inside-a-gameobject-from-another-monobehaviour/20318 "2011-05-02T20:46:32Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![Agustin\_Petrini](https://dub1.discourse-cdn.com/unity/user_avatar/discussions.unity.com/agustin_petrini/32/461322_2.png) [@Agustin\_Petrini](https://discussions.unity.com/u/Agustin_Petrini)
#### Post date: [May 2, 2011, 8:46pm UTC](https://discussions.unity.com/t/how-can-i-reference-a-specific-script-inside-a-gameobject-from-another-monobehaviour/20318/1 "2011-05-02T20:46:32Z")

</div>

So the documentation [here](http://unity3d.com/support/documentation/ScriptReference/index.Accessing_Other_Game_Objects.html) says: _"You can also expose references to other objects to the inspector. Below you can drag a game object that contains the OtherScript on the target slot in the inspector."_

Now what if I have several scripts of that type in that GameObject, only the first one seems to be referenced. Is there a way to pick one from the inspector ?

---

<div class="post-metadata">

### Author: ![Agustin\_Petrini](https://dub1.discourse-cdn.com/unity/user_avatar/discussions.unity.com/agustin_petrini/32/461322_2.png) [@Agustin\_Petrini](https://discussions.unity.com/u/Agustin_Petrini)
#### Post date: [September 22, 2011, 5:03pm UTC](https://discussions.unity.com/t/how-can-i-reference-a-specific-script-inside-a-gameobject-from-another-monobehaviour/20318/3 "2011-09-22T17:03:08Z")

</div>

[http://forum.unity3d.com/threads/97583-Referencing-a-script-on-a-GameObject-in-a-MonoBehaviour-in-another-GameObject](http://forum.unity3d.com/threads/97583-Referencing-a-script-on-a-GameObject-in-a-MonoBehaviour-in-another-GameObject)

---

<div class="post-metadata">

### Author: ![DaveA](https://avatars.discourse-cdn.com/v4/letter/d/8e8cbc/32.png) [@DaveA](https://discussions.unity.com/u/DaveA)
#### Post date: [May 2, 2011, 9:53pm UTC](https://discussions.unity.com/t/how-can-i-reference-a-specific-script-inside-a-gameobject-from-another-monobehaviour/20318/2 "2011-05-02T21:53:14Z")

</div>

You can use GetComponents or GetComponentsInChildren to get an array of them. How you distinguish them is up to you.
