Is there a way to find all the occurrences of a given asset (where it is being used). i.e the opposite of “select dependencies”.
It’s easy to click on an asset or prefab and then navigate to its dependencies (for example find the texture used by a given material). I’m looking for the reverse navigate - from the texture find all the materials that use it, if any.
I know it’s been a while, but you can open .meta file of your asset in question, grab the value of guid field and then simply search by this value through all the files (e.g. by using git grep <my_asset_guid>).
This gives you a really quick and useful outlook of whether the asset is used and where exactly. Of course it might not fit every bill, but this is my favorite way of “finding usages” because it’s virtually agnostic to Unity version and doesn’t depend on any extra downloads or scripting.
Is there a way to find all the occurrences of a given asset (where it is being used). i.e the opposite of “select dependencies”.
Hi! There’s a tool which has the opposite core idea to Unity’s Select Dependencies. After several major updates, an asset offers great interface for working with results and is much faster.
var go : GameObject;
var gos = GameObject.FindGameObjectsWithTag ("TAG YOU THINK YOU WANT");
//finds all gameobjects of that tag, loads them into an array
for (go in gos)
{
if(go.renderer.material == " MATERIAL NAME HERE")
{
print(gameObject);
}
}
When I want to find this out, usually I take the asset out of the project, or make it cause an error in some way–and then all the objects with that asset will throw errors. This works for scripts, which is usually what I’m looking for when I’m doing this. Does that answer your question?