On collision with an object, pick it up?

Hey I really need help with this, it’s for a school assignment.

I have a game where you need to find skulls, you pick them up and once you have found all of them you escape the level.

I’m a very beginner coder so I would like some help with how to do this.

At the moment I have a code that destroys the object on collision and plays a sound to let you know it got picked up.

How can I make it so that instead of just playing a sound, the object is destroyed and a number on the screen goes up one.

E.g. I am walking around, the top left of my screen says " 0/5 "

then when I walk over the skull it says " 1/5 "

Then once I found all 5 skulls it goes to a new scene.

Please help, this is really bugging me!

Easy! If you are using C#, Add in a public static int skulls somewhere in one of your game manager scripts. When the player collides with the skull simply put in YOUR_GAME_MANAGER_SCRIPT_HERE.skulls++;. And now you have edit the text at the top to say

text = YOUR_GAME_MANAGER_SCRIPT_HERE.skulls + "/5";

Applying this to your existing code should work! :slight_smile: