Problems with Resources.Load method

Hi all, I am developing a videogame where there are some players and the color of their t-shirt will change depending on the selection of the user in a menu. For this reason, I have all the textures in “psd” format in the folder “Assets/Resources”, but when I try to load it in the “Start” method:

mat = Resources.Load("redTshirt", typeof(Material)) as Material;
if (mat == null)
	print("It is NOT null");

The result is “null”. I do not know what I am doing wrong… I want to assign this material later to the Skinned Mesh Renderer… obviously, it is not working because I cannot load the Material. But I do not know what else to try. I tried exporting the psd file into a png, and even creating a new project, but I get the same result.

Can anyone tell me what I am doing wrong?

Thank you very much !

Remember textures are just one part of a material. In that code you are trying to set a material equal to a texture which will not work. They are two different things.

To assign a material you need to have an actual material in the resources folder. From there, you can load up that material and “attach” it to your character.
[Resources folder has a Material labeled “Mat1” for this example]

Public GameObject testObj; 

Void Start()
        testObj.GetComponent<Renderer>().material = (Material)Resources.Load("Mat1"); 

If you want to use the same material and just swap out the textures, use this next one instead. I would just save it as PNG or JPEG, guessing PSD will cause you problems. This will access the material on your object and swap out the texture.

testObj.GetComponent<Renderer>().material.mainTexture = (Texture)Resources.Load("textureName");