How to make Colectable items

Hi!

I’m making a 2.5D platformer and I want to make colectable items (such as coins in Super Mario Bros). In my game, the colectiles are similar to Lums (Rayman).
And I want to make it appear the “score” on screen.

How can I make it work in terms of scripts?

Thanks.

EDIT.
some of the collectibles are similar to lums (rayman). How to make it happen in Unity?

Attach this to your player and make sure to tag your collectable object with the tag collectable and also make sure that you have ticked the “is Trigger” box on your collectables as well.

using UnityEngine;
using System.Collections;

public class collectableDestroy : MonoBehaviour {
	private int collected = 0; //Set up a variable to store how many you've collected
	public AudioClip collectedSound;	 //This is the sound that will play after you collect one
	
	//This is the text that displayed how many you've collected in the top left corner
	void OnGUI(){
		GUI.Label(new Rect(10, 10, 50, 20), "Collected:" + collected);
	}

	private void OnTriggerEnter(Collider other){ //Checks to see if you've collided with another object
		if(other.CompareTag("collectable")){ //checks to see if this object is tagged with "collectable"
			audio.PlayOneShot(collectedSound); //plays the sound assigned to collectedSound
			collected++; //adds a count of +1 to the collected variable
			Destroy(other.gameObject); //destroy's the collectable
		}

	// Use this for initialization
	void Start () {
	
	}
	
	// Update is called once per frame
	void Update () {
	
	}


	}

Thanks. But instead of text “collected”, I want a texture.

I created a Gameobject Guitexture. But I want the display the collected items in front of it.

some of the collectibles are similar to lums (rayman). How to make it happen in Unity? (im talking about the light of the object)

Hey guys another question. How can I make that “magnet effect” on my collectibles?
I will give an example:

What I want is when you are near of a collectible, the object comes to you.

Maybe you were looking for something similar?

For other people who might be looking for the answer on making collectibles you might want to take a look at a ready solution


Collect Me 8 on Asset Store