Little help with GUI Toggle needed


I'm just wondering if someone could help me out a little bit with a GUI.toggle function. I'm working from the example documented here:, which uses the following example:

toggleBool = GUI.Toggle (Rect (25, 25, 100, 30), toggleBool, "Toggle");

The code that I'm having a problem with is:

Initial.autosubmit = GUI.Toggle(Rect(325,150,100,50),Initial.autosubmit,"");

I'm getting this error message: Assets/menugui.js(14,32): BCE0023: No appropriate version of 'UnityEngine.GUI.Toggle' for the argument list '(UnityEngine.Rect, int, String)' was found.

I'm confused here, because as far as I can tell mine has the exact same syntax as theirs.

Initial.autosubmit is defined in Initial.js, as:

static var autosubmit=0;

I see two problems, one of which is one of the reasons I don't use Javascript at all.

static var autosubmit = 0;

Javascript interperets that as an integer, and the `GUI.Toggle` function takes a boolean, not an integer. You want:

static var autosubmit : bool = false;

The other potential problem I see (though this probably isn't an issue), is that you left out your GUIStyle parameter on the end. Either insert a style name, or leave the parameter out.

Initial.autosubmit = GUI.Toggle(Rect(325, 150, 100, 50), Initial.autosubmit);