Pickup note when click on it

Hi ,

I’m making an Amnesia/Slender like game and i have a problem with my script to pickup letters/notes

What i want to reach is that when you click a 3d model of a letter/note , a GUI image of the note appears on the screen and there has to be an exit button to destroy the image popping up .

Here’s my script :

var showing: boolean;

var Pic: Texture2D;

var exitButtonRect: Rect;

function OnMouseDown() {

GUI.DrawTexture(Rect(0, 0, Screen.width, Screen.height), Pic);
showing = true;
}

function OnGUI () {

if (!showing) return;


if (GUI.Button(exitButtonRect, "Exit")) {
    showing = false;
}

}

Try to move the DrawTexture call to the OnGUI function.