Collestion of objects

Hello,How to make object when u click on him it vanishes and on screen it says like 1/10 items collected?

TextMesh

and OnMouseDown

sry mate but I’m not very good at this…
Should i write something like this for “OnMouseDown”

// Loads the level named “SomeLevel” as a response
// to the user clicking on the object

function OnMouseDown () {
Application.LoadLevel (“SomeLevel”);
}

please don’t create new answers as comments, use the comment instead…

as for your question, you need to set up a simple script to keep track of the number of your items collected, and display the total. Here’s a simple example:

static var itemsCollected : int; 
var display : boolean = false;

function OnMouseDown(){
if(!display){
itemsCollected += 1;
display = true;
var mesh : MeshRenderer = GetComponent(MeshRenderer);
mesh.enabled = false;
yield WaitForSeconds(5);
Destroy(gameObject);
}
}

function OnGUI(){
if(display)
GUI.Label(Rect(Screen.width/2 - 60,20, 120, 20), "Items Collected: " + itemsCollected);
}

just attach this javascript to your prefab, and it should do what you ask…

EDIT: updated this slightly, as the previous version could cause unwanted issues…