- Home /
How can I tell what prefabs a child object (script) is in?
I have a script in my project. I know that it is in several places but I want to be sure I find every instance of it. Is there an easy way to tell what prefabs a child object is contained in?
Sorry for such a lame question. I'm new to Unity and since I couldn't find an answer, I assume it's probably a stupid question.
Answer by Waz · Sep 08, 2011 at 11:04 AM
See http://answers.unity3d.com/questions/9562/how-can-i-see-script-dependencies.html
Note that in current Unity, you can Select Dependencies of scripts just fine.
Answer by aldonaletto · Sep 07, 2011 at 10:22 PM
This isn't a stupid question: I had this problem many and many times too - so many times that I finally created a simple way to find it. Attach this line to Start in the script you want to find (all instances will be affected):
function Start(){ print("I am in "+name); ... }This will print the name of each object containing this script. If you have lots of objects with the same name, however, you may need some visual aid. Call this function inside Start:
function IAmHere(){ while (true){ Debug.DrawRay(transform.position, 20*Vector3.up, Color.red); yield; } }
function Start(){ IAmHere(); ... } This will show a 20 m red line over each object containing the script (remember to click the button Gizmos over the Game view, or nothing will be drawn).