Switching plane texture through script

Complete newbie here. I have two planes, with albedo set to green and white. I have a texture (png, 16-bit, 256x256, it just has an alphabet with transparent pixels all around) that I’d like the plane to show at runtime, when an event happens. After searching the internet including this forum, I did this:

Material newMaterial = (Material) Resources.Load(“AnotherMaterial”, typeof(Material));
planeObject.GetComponent < MeshRenderer > ().material = newMaterial;

I can see that when the event triggers, the color of the plane changes to a pinkish color, but not to the texture. Same thing happens on either plane. I also tried not using my png texture, but making “AnotherMaterial” have a different color. Result is the same.

Could someone explain how to do this right?

OK I figured out the answer shortly after my post. Leaving it here in case someone else has the same trouble.

It looks like Resources.Load() works only if the asset is under a folder called Resources (under Assets directory). So I made Resources/Materials folder, and changed my load to

Material newMaterial = (Material) Resources.Load(“Materials/AnotherMaterial”, typeof(Material));

and that worked. I didn’t realize that the “pink color” that showed up earlier was due to the material not being found - I had assumed I’d see an error in that case.