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 ;/ )
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.
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.
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!
This repository can help you. It’s forked from an old abandoned repository and currently has very minimal changes to make it work - demo scenes might not be functional. However, it’s everything I was looking for when I stumbled across this question
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