Window problem ( new unity user)

Hi everybody,
I’ve got a little problem:
I creat a “newbehavior script”,no problem to compil.
I put it in a box to execute the function.
And when I play,I walk, I clic on the box, and Unity say : “NullReferenceException: Object reference not set to an instance of an object”

I don’t know what it means…

This is my script :
var fenetre = Rect (200, 200, 1200, 500);

function OnMouseOver() {

fenetre = GUI.Window (0, fenetre, bouton, “Menu”);

}

function bouton () {

if (GUI.Button (Rect(100, 200, 100, 200), “Contact”))

Application.OpenURL (“mailto:gul_ze_ouf@hotmail.com”);

}

Thanks very much for helping
Gul

I think the error is generated by the GUI.Window call outside the OnGUI handler.

try moving that code to OnGUI()

function OnGUI () {
fenetre = GUI.Window (0, fenetre, bouton, "Menu");
}

Hi,
Thank you :smile:

Gul