How to add Collectible objects in our games!
Have you ever asked to yourself how can we pick objects inside a game?

We all have played some Mario, Zelda, Subway Surffers, Pacman etc… at least once. In those games, the player need to pick coins and items because is part of the fun or just to make the player stronger.
Picking objects, it’s one of the most basic and common concepts in videogames since their creation on the 70's.
How to pick objects inside Unity?
There are no complicated logic on picking objects. We just need physic colliders in both objects: The player and the item/coin we want to pick.
Setting up player’s physics

Let’s add a collider to our player, it can be of any kind(Box, capsule, circle etc…). I’ll choose the Capsule Collider.
Setting up our Coin

Once we create a empty cube with a Box Collider set as Trigger we can switch to our code editor and create a coin class.
Coin.cs class

Here, we are just simply telling the coin to give the player 1 score point and disabling the same coin once they collide.