How to make a 2d platformer in unity - Part 3 (Coin Pickup & UI Counter)

Опубликовано: 15 Апрель 2026
на канале: MrWonderHow
239
2

In this short but powerful continuation of our Unity 2D platformer series, we’ll make our coins functional!
You’ll learn how to use trigger colliders, write a simple coin pickup script, and create a clean UI coin counter that updates in real-time when the player collects coins.



✅ In this video, you’ll learn how to:
• Add Box Collider 2D and set it as Trigger for coins
• Detect collision between coin and player
• Destroy the coin on pickup
• Create a CoinManager singleton to track coins
• Display collected coins using TextMeshPro UI



Key moments:
00:00 Introduce
00:31 Add collider to coin prefab
00:45 Coin Script
02:04 Create UI to count collected coins
03:07 Create Coin Manager script

🧠 Skills covered:
• Unity 2D colliders and triggers
• Using OnTriggerEnter2D
• Singleton pattern for managers
• Updating UI in real-time with TextMeshPro



📦 Scripts Used:
• Coin.cs – Detect player pickup
• CoinManager.cs – Handle coin counting and UI update



📺 Watch Part 1 & 2 of the series:
P1:    • How to make a 2d platformer in unity -  Pa...  
P2:    • How to make a 2d platformer in unity -  Pa...  
P4:    • How to make a 2d platformer in unity -  Pa...  


🧠 Stay tuned for the next parts where we’ll cover:
• Sword hit detection
• Enemy and player health
• Enemy movement logic



👍 Like, 💬 Comment, and 🔔 Subscribe to Mr Wonder How to keep up with the series!

Thanks to Music and sounds :
Artist Abstraction from https://tallbeard.itch.io/music-loop-...
https://leohpaz.itch.io/minifantasy-d...
Sound Effect by chieuk from Pixabay

Source code available on my patreon (FREE)
https://www.patreon.com/posts/https-y...

Link to game assets:
https://ansimuz.itch.io/gothicvania-p...

#unity2d #unitytutorial #platformergame #gamedev #unityui #mrwonderhow