Change texture of GUItexture from script

how to change texture of GUItexture with the name of the texture?

something like this…

var texturename="casualtexture";


You can also assign Texture2D link as public variables and assign GuiTexture like that. For example:

( C# code follows )

public GuiTexture clickButton;
public Texture2D clickButtonTexture;

clickButton.guiTexture.texture = clickButtonTexture;

same problem for audiosource…

    var audioname="casualsound";


I created the folder resources in assets

I put my image files inside…

var texturenameok=Resources.Load(texturename);
GameObject.Find(photo1).guiTexture.texture=texture nameok;

HA! I think this post just solved like, 3 problems for me! I had no idea UNITY did resources!