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.
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:
It shows you particular fields where the asset is used
It allows you to easily replace it
Search for further usages of assets in the results list
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: NinjaCamp III: What references your assets? | Unity Blog
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.
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): [22679-helpers.unitypackage.zip|22679]