Creating Collectables In Unity

At this level, it’s pretty easy to handle collectables in Unity: Just sure to check the collider’s are is Trigger and do not forget to add Rigidbody. Thus, I have created a Coin script for the spheres (hey! they are our future coins!).

Coins Script

Certainly, our player needs to know how many coin that we have collected and a function to update the coins and UI Manager.

And certainly, the UI Manager. We need to remember the best practice — use Singleton!

And that’s all :).