GUI help

I just started working with GUI’s so i am rather new. I am using the documentation’s image script for putting an image on a GUI.

var icon : Texture;

function OnGUI () {
    GUI.Button (Rect (10, 10, 100, 100), GUIContent (icon));
}

all it does it create the GUI in the right area and the right size. It is not displaying the image.
No compiler errors are showing up. If someone can help it would be very appreciated.

did you assign a texture to icon? Without the texture assigned it just outputs the normal button.

i assigned a photo to it. the project i am working on is a portfolio thing for my boces class. the pic is a photoshop format. if this cant work, is there a way to fix it.

bump.

The code looks OK. Does it make a difference if you remove the GUIContent constructor? (There is a version of GUI.Button that takes a texture as the second parameter.)

to be completely honest I have no idea what that means. i haven’t done anything with GUI’s except this.

Try this.

var icon : Texture;

function OnGUI () {
    GUI.Button (Rect (10, 10, 100, 100), icon);
}

:wink:

okay ill try that when i get the chance thanks