- Home /
Can the Unity Editor 'Find References' for a particular Game Object; like MonoDevelop can for highlighed variables?
Hello,
Being able to "Find References" in MonoDevelop is incredibly useful. Is there a way to do the same in the Unity editor? For example, can I select a GameObject in the Hierarchy view and then somehow see all its (possible) connections to other.. scripts or what-have-you?
[edit] "connections to other.. scripts;" those DO show up in the inspector, my bad. What I'm Really looking for is possible REFERENCES of selected GOs in other scripts; that's what I mean by "connections." Pardon my unfamiliarity with the proper terminology.
[edit2] By "REFERENCES" I mean like when you drag and drop a GO onto a script's public variable in the inspector. There are cases where I've dragged and dropped a GO onto several scripts and it would be extremely helpful to be able to find/see all its references/connections in the unity Editor. (Perhaps such a feature already exists and I just don't know how to find/look for it ;/ )
Answer by viesc123 · Jul 16, 2020 at 05:30 PM
You can select a GameObject in a scene and right-click any of it's components in the Inspector and select "Find References In Scene". It will look for all references to that component and in turn (since the GameObject references it) also to all references of the GameObject. Works similar to the Find Reference command for assets, in that it will show chain-references (A is referenced by B, B is referenced by C...) Dunno if this functionality is new or if has been here all along.
Answer by Gotlight · Mar 30, 2017 at 08:22 PM
Hi @donimation! If I got it right, you look for a usage/reference finder asset.
You mentioned our tool, Asset Usage Finder, but probably aren't sure if it will be worth the money. Based on experience of users that bought it, the tool saves you much more than it costs (take a look at reviews on Asset Store). Btw, it's being used not only for finding references, but for cleaning the project, too.
https://www.assetstore.unity3d.com/en/#!/content/59997
If Asset Usage Finder looks good to you, buy it. In case it won't be useful for you, we'll refund you the full price!
Denis
Answer by erik7302 · Mar 12, 2017 at 06:10 PM
use get component to your proyect
example:
using UnityEngine;
public class Script1 : MonoBehaviour
{
public int Test = 1;
public GameObject;
}
other script
using UnityEngine;
public class Script2 : MonoBehaviour
//This script is used to change a value or get an object from another script
void Start()
{
Script1 S = GetComponent<Script1>();
S.Test = 2;
Cube = S.GameObject;
}
If this does not help, be more specific than what you want to do
Answer by jjcrawley · Mar 10, 2017 at 02:14 AM
If I've read the question right, you would like to know whether there is a way to see all the objects that use an object.
You're after EditorUtility.CollectDependencies, this should find the dependencies of the objects that you provide it.
Here's a link to the documentation on it: https://docs.unity3d.com/ScriptReference/EditorUtility.CollectDependencies.html
Bare in mind, this is only available in the editor, and you have to write your own custom script to use the method.
Hopefully this is what you're after.
Thanks for the reply jj! I looked at the documentation you provided and I'm trying to figure out how to open that [EditorUtilityColl] tab on the (I'm guessing) inspector (?) so I can "Find/Check Dependencies"
By "write your own custom script to use the method." you probably mean.. I need to create a script (code provided in documentation I guess ?) to get it to show up on the editor?
I was hoping for some window I could find in like Edit>Project settings or something.
I found a similar question here: http://answers.unity3d.com/questions/179224/is-there-a-way-find-usage-of-an-asset.html
and I guess there are assets that do something like that (and then $ome) https://www.assetstore.unity3d.com/en/#!/content/59997
but I was hoping for something slightly more.. accessible.
Answer by Ogdy · Apr 23, 2020 at 12:08 PM
Hi,
Check out this open source tool ! It is perfect for finding dependencies of an asset and what references it.
https://github.com/ogxd/project-curator
Have fun !
Note: This works nicely for finding where specific Assets like materials are referenced, it doesn't find references to particular GameObjects linked in the Inspector as the OP talks about
Your answer
Follow this Question
Related Questions
editor map grid view 0 Answers
Search game objects with script 1 Answer
3d mouse support in editor? 1 Answer
Editor Camera Orthograpric Control 5 Answers
Move Around in The Editor 1 Answer