function OnGUI with Input.GetMouse the right?

Hello I was wondering if you could put together a function GUI with the click of the mouse.
I tried to do that after clicking on an object appear a window with a button ( the idea of the window with the button is it would be a type of speech where when click the button change speech). I tried to make a code to see if it worked but seems to not work

Below the scrippt that I made

I wonder if it would be possible to do this? If you can explain with an example?

 #pragma strict

var Person: GameObject;


funcionar OnGUI () {

if (Input.GetMouseButtonDown == persona) {

var windowRect: Rect = Rect (70,70,180,70);

windowRect = GUI.Window (0, windowRect, WindowFunction, "My Window");
}

    }

função WindowFunction (WindowID: int) {
 
    if (GUI.Button (Rect (20,20,70,25), "Button")) {
     
}
        }

You generally wouldn’t want to use Input functions in OnGUI. Use Event.current instead, such as Event.current.type == EventType.MouseDown.

–Eric

I don’t understand but I tried the script, nut if seems that the function does not perform.
Could you aleborate? type with an example to see how the function works