- Home /
How can I Find All References to an object in the inspector?
I have inherited a huge project in Unity 3.5, which makes heavy use of dragging/picking object references from an object in the hierarchy to some other object in the hierarchy. There is no documentation covering what all objects in the scene are referencing some other given object in the scene, and as I mentioned, the project is quite large - main scene containing about 16k objects.
I need a way to search from the target object to find all other objects in the scene that are referencing it. Obviously, going the other way, the editor will ping the object you're tying a reference to. However, I'm looking at objects in the hierarchy that need to be investigated, but I can't easily locate all the things controlling it or interacting with it.
Any technique akin to doing a "Find All References" on an object in C# would be greatly appreciated.
I havent used anything like that, but you could try tagging the objeccts and search them by tag in the scene hierarchy.
In my project, I use plugin 'Find Pro' to find out all references to an asset.
It's easy to use and it supports searching both in the project folder and in the scenes.
Details: https://www.assetstore.unity3d.com/#!/content/45693
Find Pro did the trick for me. Select Results in Hierarchy View, click the object you want to find in the Hierarchy and press Select, Root, then Search. Definitely worth $25 - thanks.
This is a off topic but are you the same sarah who developed Rebuild?
Unfortunately, it seems like Find Pro solution doesn't exist anymore, but this one did the trick for me (asset usage finder) , very simple interface, powerful and costs only 7$
Answer by Gotlight · Sep 16, 2016 at 10:11 PM
However, I'm looking at objects in the hierarchy that need to be investigated, but I can't easily locate all the things controlling it or interacting with it.
Hi @KevinW ! I know it might be a bit late, but there's an elegant solution (an asset) for this.
Its main idea is opposite to Unity's Select Dependencies feature, yet asset is offering much more (see screenshot below).
Key features:
1) It shows you particular fields where the asset is used
2) It allows you to easily replace it
3) Search for further usages of assets in the results list
Asset Store link:
NOTE: I'm one of the authors of Asset Usage Finder and I will be happy to answer your possible questions on our product
UPDATE: v3.0 was released! More than 20x faster compared to 2.0 version
The opening post is asking how to find all references to a gameObject. You answer is irrelevant because you talk about how to find all references to an asset.
Hi kamran, $$anonymous$$evinW was asking about objects, most likely meaning UnityEngine.Object which gameObject inherits from.
Asset in our case means any item that can be used in game or project as defined here: https://docs.unity3d.com/$$anonymous$$anual/AssetWorkflow.html
Asset Usage Finder in the result finds all references of UnityEngine.Object in both project and scenes, so my answer is pretty relevant.
Thanks
@Gotlight Yes. You are correct and thank you for clarification. I bought the asset and it can find all references to a gameObject in the scene. By the way, I noticed that you are the author of this asset but it's not obvious in your answer. It would be nice to disclose this fact in your answer.
@kamran-bigdely I'm glad you've chosen our product. Thanks for noticing that detail, I have added a note to my original answer
Answer by TonyLi · Feb 24, 2014 at 05:33 AM
There's an ugly way, but it'll give you every reference, and you can script it to make it a littler easier.
Change Asset Serialization to Force Text (Edit > Project Settings > Editor). You need Unity 4+ or Unity 3.x Pro to do this.
The scene file (.unity) will contain blocks of text like this:
--- !u!1 &1116311739
GameObject:
m_Component:
- 4: {fileID: 1116311741}
- 114: {fileID: 1116311740}
m_Name: Object1
--- !u!114 &1116311740
MonoBehaviour:
m_Script: {fileID: 11500000, guid: 522cee70d3f794241885ec229977790f, type: 3}
anotherObject: {fileID: 107191716}
--- !u!4 &1116311741
For clarity, I cut several lines. This is a GameObject named "Object1". It has a fileID of "1116311739". It also has a script with a fileID of "1116311740". That script has a field that references another object with file ID "107191716".
So hopefully this gives you an idea of how you can parse through the .unity file to get a list of all references.
If you only want to go through the GUI, then you can make sure everything is built from prefabs or basic types (textures, etc.). Then right-click on each prefab and select "Find References in Scene" similarly to how it's described here: http://blogs.unity3d.com/2011/03/24/ninjacamp-iii-what-references-your-assets/
Or, for something in between, you can use EditorUtility.CollectReferences() but it'll still take some scripting work. This answer gives an idea of how to go about it.
Answer by whydoidoit · Feb 24, 2014 at 05:47 AM
Ok so I've got something that might help with that graphically (attached). It lets you examine the scene objects that selects anything which has a dependency on them (using the "@" button). You need to open the window using
Window > whydoidoit > Recent Selections
Then switch to the Scene Assets tab and open the section for the kind of thing you are looking for etc.
The package is here (should hopefully contain everything): link text
Sorry you'll have to cope with the ugly italic embeds around a few things, not updated it since the GUI slightly changed in Unity.
And the other tabs on here have a different function (it lists the items you recently selected so you can go back to them quickly when navigating the project - I just put scene assets on here as a place to call home, it's not really related to the other bits though!)
Answer by mobstgram · Oct 08, 2016 at 02:49 PM
How about using this asset ? https://www.assetstore.unity3d.com/en/#!/content/69028