Everything But the Texture: GUI Button Shape

Hi there, With a GUI button, it always seems to be a rounded rectangle of sorts. I am wondering, say I have a button, which is an arrow. It is an image I am using. So I would want to use the image as the texture but I would like the button to be just it, just the image, nothing else. So, how do I get rid of everything but the texture?

You have to create a custom style to get rid of the default rounded button borders.
Just add something like this somewhere in your init :

GUIStyle style = new GUIStyle();

And when you want to use your button, use this style :

bool bClic = GUI.Button(myrect, mytexture, style);

:smile:

ok, thanks.
But why create a bool? I am not familiar with that logic.

Is it the same as simply creating a
if(GUI.Button())

?

Yes, this is the same, this was just an example using a boolean variable from one of my scripts.

so you are using c#.
Would this be placed in an update, input function? And not to sound dumb, but how does
bool varName = blah blah blah.
mean anything? Concentrating on the bool. Must the bool be true? How is it set to true? Just on input down?

Everything inside an if conditional is a boolean (either from a bool value, an evaluated boolean - does x equal y? - or from a method call that returns a boolean value). The value of whatever is being evaluated in the if must be true for that code to be executed. OnGUI is done twice per frame in order to first draw the UI and second capture events. When you put a Button inside an if condition you’re basically saying “if the event capturing pass of OnGUI registers that the user clicked this button”.

Touche.

But this brings up a couple of other things.
A. While i except that in onGui() …
If(GUI.Button(30,40,10,10, “sure”)

Will place a gui button of the size and place i asked and inlude the word sure… I do not get how it is drawn or, and correct me if i am wrong but how that button knows that it is being clicked. This is not huge because i can except it, i am just trying to see the logic of the code. This is the same for the ealier bool example.