Readable Notes + Text?

Ive created a script so when I pick up a key, it disapears.

function OnMouseDown()
{
  Destroy(gameObject);
}

( pretty basic i know )
So now I wanted a text to appear at the bottom of the screen saing “Key Obtained”, how would I acheive this? Thankyou :slight_smile:
I am a begginer at Java scripting.

And I also wanted to make Notes that you can pick up. so when you Click on a note (piece of paper), It makes a Picutre of the note, with the text on it, pop up on the screen basically covering the whole screen. It would also be very nice if you knew how to do that :smile:

Basically you want to make a new function, which displays the GUI elements. In the syntax, you want to create a new ‘label’ (or box), which will display the content/ you picked up. I don’t know what the syntax is for Javascript, but in C# it is:

// We have a new function which checks OnGUI (which is about every frame, if I am correct)
void OnGUI() {
      // First, we want to check if we picked up the key
      if (keyPickedUp == true){
            // Now onto the creation of the text!
            GUI.Label(new Rect(200, 200, 150, 20), "We picked up a key!");
            // Now we need to actually create some sort of countdown script, just so that the GUI element is removed after a set amount of time
            CallTimer(); // This calls a function called CallTimer()
      }
}

That’s for the GUI function. We need to add two more things. First, at the function OnMouseDown(), we want to insert a new line, which says keyPickedUp = true. (and in the beginning of the script we add: “var keyPickedUp = false” (again, syntaxes could be incorrect since I mainly program in C#)

Basically now we have GUI button which will say we picked up a key, forever.

This is why we call the CallTimer() function. Basically what we need to do is create a timer, and when it finishes counting, we want to set “var keyPickedUp = false”, again.

I hope this helps you! The syntaxes are in C#, but you can google for “Javascript timer/ Unity3D timer script” and you can look up the reference manual for the OnGUI function.

Good luck!

Great, but I came here for the readable note code. Any ideas?