GUI style

Hi all,

Trying to get the GUI buttons to do something but because I’m using GUIStyle the usual way of opening an url or playing an animation doesn’t seem to work and just comes up with errors.

Is there something I am missing here?

Obviously the web address inst in the below example and the animation script inst there either. Could anyone help me or point me out to a working example I can use. The below script is unityscript/javascript.

Thank you

var custombar : GUIStyle;
var custombutton : GUIStyle;
var roofon : //animation;
var roofoff : //animation;
var cottage : GameObject;
 

	function OnGUI () {
		GUI.BeginGroup (new Rect (Screen.width /2 - 320, Screen.height - 60, 640, 60), custombar);
		
		if (GUI.Button (Rect (3,5,154,30), "website", custombutton));{
		Application.OpenURL("http://...");
		)
		
		if (GUI.Button (Rect (163,5,154,30), "contact", custombutton));{
		Application.OpenURL("http://...");
		)
		
		if (GUI.Button (Rect (323,5,154,30), "roof on/off", custombutton));{
		// Play animation roofoff, if roofoff isplaying play roofon.
		}
		if (GUI.Button (Rect (483,5,154,30), "close", custombutton));{
		Application.//close application
		)

		GUI.EndGroup();
	}

why do you have a semicolon at the end of the if statement :stuck_out_tongue:

@stridervan +1
@Zin this should fix it

var custombar : GUIStyle;
var custombutton : GUIStyle;
var roofon : //animation;
var roofoff : //animation;
var cottage : GameObject;

function OnGUI () {
GUI.BeginGroup (new Rect (Screen.width /2 - 320, Screen.height - 60, 640, 60), custombar);

if (GUI.Button (Rect (3,5,154,30), “website”, custombutton))
{
Application.OpenURL(“http://…”);
)

if (GUI.Button (Rect (163,5,154,30), “contact”, custombutton))
{
Application.OpenURL(“http://…”);
)

if (GUI.Button (Rect (323,5,154,30), “roof on/off”, custombutton))
{
// Play animation roofoff, if roofoff isplaying play roofon.
}
if (GUI.Button (Rect (483,5,154,30), “close”, custombutton))
{
Application.//close application
)

GUI.EndGroup();
}