Beginner question about GUI scripting

Hi all. I’m trying to learn all about GUI and Javascript. In the GUI Basics documentation ( you’re shown how to create buttons and place images on them using

/* Texture2D Content example */

var controlTexture : Texture2D;

function OnGUI () {
GUI.Label (Rect (0,0,100,50), controlTexture);

The example then shows a buttonw ith an image, but I still don’t understand where the image comes from - having copied the code and played around with it, I can’t replicate it!

It comes from you dragging it onto the Texture2D slot in the inspector.

Attach this script to any object, then click the object: in the Inspector you will see the script name and a field named Control Texture - click the small round “dot” button at the right and select the texture you want. The textures that will appear are those already imported to the project with Assets/Import New Asset menu option; if you want to create your own texture, do it with Photoshop or other image editor, save it and then import the texture to your project.