How can I find out where a particular texture is being used in my Unity project?

How can I find out where a particular texture is being used in my Unity project?

I have a texture in my assets, and I need to find out where it's being used so that I can change some textures in my project.
How can I find out where a specific texture is used in my project?
The case is that the game needs to be updated to have a Christmas look, so there are a few game textures should be replaced.

This resource checker does not work for me. It shows that there are no textures even though there are:

Solutions/Answers:

Answer 1:

To solve the problem just create a script that assigns a texture to a material based on a specific condition. The script should contain the two textures, and it should also get the object material. All you have to do is assign this script to each object you want to change the material’s texture to.

If you want to see where a texture/ or a resource is currently being used in your game/scene here is a good tool which lets you do it: Unity Resource Checker

Also check out this thread for more information.

Answer 2:

If you’re comfortable with using the command line, you could look through every file in the project for the texture’s guid. On my Mac, I have added these functions to my .bash_profile which helps in this regard:

function findasset(){
  LANG=C;
  guid=$(find . -iname "$1".meta -print0 | xargs -0 grep guid: | cut -d" " -f 2);
  echo $guid;
  findguid $guid;
}
function findguid(){
  LANG=C;
  guid=$1;
  find . -iname "*.unity" -print0 | xargs -0 grep $guid;
  find . -iname "*.prefab" -print0 | xargs -0 grep $guid;
  find . -iname "*.mat" -print0 | xargs -0 grep $guid;
  find . -iname "*.controller" -print0 | xargs -0 grep $guid;
  find . -iname "*.anim" -print0 | xargs -0 grep $guid;
  find . -iname "*.asset" -print0 | xargs -0 grep $guid;
}

Then, in my terminal window, I navigate to the project’s root Assets folder, and simply type, for example, findasset mytexture.png and as long as that filename is unique within the project, it will print out all of the Scenes, Prefabs, Materials, Animatorcontrollers, Animations, and ScriptableObjects that reference said asset.

This was my approach because when I implemented something similar in Unity I found it to be unreliable at finding all the references. This may be tedious if looking for a large number of files, but in my experience it does find everything fairly reliably.

References