13. 2D Platformer in Unity: Collectibles

Welcome to Part 13 of our 2D platformer series, and congratulations on making it to Phase 3! Now that our core character mechanics are finished, it's time to add the actual gameplay loop. Today, we are placing our first collectible Diamond in the world. We will learn the difference between a solid Collider and a Trigger, how to use Unity's Tag system to identify the Player, and how to write a custom method (OnTriggerEnter2D) to destroy the Diamond when we collect it. In this video, you will learn: How to configure a Collider2D as a Trigger. How to use Unity's Tagging system to identify specific game objects. How to write the OnTriggerEnter2D method. How to use parameters to evaluate behavior (Collider2D collision). How to use the Destroy() function in C#.