button question

Hello, all.
I have a question.
I have this script:
function ()
{
if(GUI.Button(“x”)) {
Application.LoadLevel(“whatever”);
}
}

Is this a good script?
It gives an error it says: put a semicolor at the end (6,2)
Ty, already

That is not a good script because everything needed for GUI.Button() is not given. Here is what you need:


  1. A “Rect()”, which contains (in this order, separated by commas)

    a)The x value for the position of the upper left corner

    b)The y value for the position of the upper left corner

    c)The width of the button

    d)The height of the button


  1. The text string of the button (you have this)

You also aren’t actually calling for a specific function instead of

function()

You need

function OnGUI()