How to Create a Collectable in Unity
Objective: download an asset and create a collectable for your game.
For this example I downloaded a 3d battery model for my game and added it to the scene.
With the model in the scene we have to add a collider component to detect the player, in this case the capsule collider is ideal for this asset.
Then We have to create a collectable script and attach it to the collectable. In the script we have to use the function on trigger enter to check the player tag and Update the UI counter and destroy the collectable given the illusion that the player collected it.
And that’s it!!! We have a new collectable for our Unity game.