Expecting :, found ; and can't figure it out...

Hey all, this is probably really simple, but I have only a basic understanding of java, and have spent too long trying to find a fix for this… I get the aforementioned error on line 5.57 in my code, pasted below.

function OnGUI () {

GUI.Box (Rect ((Screen.width/2)-60,(Screen.height/2)-50,120,105), "Menu");

GUI.Button (Rect ((Screen.width/2)-50,(Screen.height/2)-25,100,30), "Load Level 1"); {
	EditorApplication.OpenScene("TestScene");
}

GUI.Button (Rect ((Screen.width/2)-50,(Screen.height/2)+15,100,30), "Load Level 2"); {
}

}

Am I doing this the wrong way or…?

Thanks in advance,

Shade

JavaScript is not Java. UnityScript is not really JavaScript.

2 Answers

2

I think it may be that you are not really constructing a Rect to pass to the GUI.Box function. Try creating your rectangles in the function using locally declared variables and then pass them, or “new” to instantiate them.

It's got everything to do with Unity, the software detected as a trojan was created with Unity. It's perfectly valid to ask such a question, perhaps it's a known issue. In your example, you should post on Microsoft forums and also the AV forums.

You’re putting a semicolon before your curly braces, and you’re not using the if keyword. The documentation show you how to do it, but they don’t have curly braces. Curly braces are optional if you would only have one statement between them.

http://unity3d.com/support/documentation/ScriptReference/GUI.Button.html