gui button textured how to

Hello!

I have that code:

if (GUI.Button(Rect(0,75,200,25), "Grass = "+grassAmount))

{

selectedBlock = grassBlock;

}

How can I change gui.button to mu own texture button in that code?

There are a lot of lines like this, well I prefer to stay with that code if its possible to make it as a texture. Please help~!

You could use GUI Style to achieve this:

Javascript:

var myButtonStyle : GUIStyle;

function OnGUI () {
	if (GUI.Button(Rect(0,75,200,25), "Grass = "+grassAmount, myButtonStyle))
	{
	selectedBlock = grassBlock;
	}
}

C#:

public GUIStyle myButtonStyle;

void OnGUI () {
	if (GUI.Button(new Rect(0,75,200,25), "Grass = "+grassAmount, myButtonStyle))
	{
	selectedBlock = grassBlock;
	}
}

In the inspector where the script is attached, you can modify the normal, hover and active textures in the myButtonStyle dropdown.

I hope this helped you @Drymarti111.